Asked by Brian
on 19 Apr 2013

Hi,

I need to export geometry from the PDE toolbox without using the menu at the top (using command line). When I use decsg, gd is undefined. I have tried using sym gd, that didn't work. When setting up zero matrices, the index exceeds dimensions. I know this is a basic question, I can't find the answer in the forum or online.

Thanks in advance

Answer by Shaun VanWeelden
on 19 Apr 2013

If you could give us your exact code you are trying now, that would be really helpful. zeros(your matrix size) should work fine no matter what toolbox you have. Unless your question is about having an unknown number of output variables.

If you know the number of output variables, like if I wanted to find the size of a 2-d matrix I would do something like this [numRows, numCols]=size(twoDmatrix);

Similarly, you can do that for output with multiple variables.

If you don't know the # of output vars, it gets more complicated, but I remember somehow being able to capture everything in a cell array, I think using the deal function or something like that.

Brian
on 20 Apr 2013

Hello sir, thanks for the reply. The code from what I have tried is:

>> dl=decsg(gd) Undefined function or variable 'gd'.

>> syms gd >> dl=decsg(gd) Error using mupadmex Error in MuPAD command: Index exceeds matrix dimensions.

Error in sym/subsref (line 1577) B = mupadmex('symobj::subsref',A.s,inds{:});

Error in decsg (line 152) lsn=sum(gd(2,gdli));

>> dl = decsg(gd, sf, ns) Error using stateflow\private\sflibrary Too many output arguments.

Error using sf Error using stateflow\private\sflibrary Too many output arguments.

>> gd = zeros(100, 100); >> dl = decsg(gd) Index exceeds matrix dimensions.

Error in decsg (line 1183) i=find(cm(i(1),:))';

I am trying to build a GUI that can export the geometry from the PDE toolbox without using the menu. I don't know what size the gd (geometry description) matrix will be for each individual use. The gd doesn't get defined until I use the menu at the top of the PDE toolbox. From documentation it says it can be done by command line, the problem is defining a variable gd (and ns, fs).

Cheers

Walter Roberson
on 20 Apr 2013

zeros(100,100) is not a valid geometry description matrix.

Brian
on 27 Apr 2013

Thanks for your reply. I have looked at that page loads of times. How can I define something if I don't know what size it will be. For the above example, gd is in the PDE toolbox , I just need to export it. Why is matlab returning "Undefined function or variable 'gd'"?

Related Content

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
## 0 Comments