how do I declare a variable matrix of any size?

조회 수: 8 (최근 30일)
Brian
Brian 2013년 4월 19일
댓글: Ruben Gavín Mulelro 2021년 5월 26일
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

답변 (1개)

Shaun VanWeelden
Shaun VanWeelden 2013년 4월 19일
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.
  댓글 수: 4
Brian
Brian 2013년 4월 27일
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'"?
Ruben Gavín Mulelro
Ruben Gavín Mulelro 2021년 5월 26일
Hello Brian,
It is not possible to use gd function if the geometry is not exported before.
I have the same problem. I am not able to export the geometry automatically, so I can't reach to resolve the problem for different dimensions.
Tell me something If you finally achieve it.
Thank you

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Geometry and Mesh에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by