what's wrong with my program?

2 views (last 30 days)
Ayob
Ayob on 24 Apr 2013
I'm completely confused.I have a large program and Matlab announce an error that I don't know what that is.
for F=1:PE*AE*RE
GGP{F}=zeros(2,12);
for i=1:12
n=0;
[GGP{F}(2,i),GGP{F}(1,i)]=cart2pol(GG{F}(1,i),GG{F}(2,i));
for j=1:NodesTETA*NodesR*NodesZ
if abs((GGP{F}(1,i)-p{j}(1))/Radiale)<1 && abs((GGP{F}(1,i)-p{j}(2))/peripherale)<1 && abs((GG{F}(3,i)-p{j}(3))/Axiale)<1
n=n+1;
NODZ{F,i}(n)=j;
end
end
end
end
for F=1:PE*AE*RE
for i=1:12
*NODZ{F,i}=[3*NODZ{F,i}-2;3*NODZ{F,i}-1;3*NODZ{F,i}];*(line 193 error)
NODZ{F,i}=NODZ{F,i}(:)';
end
end
MATLAB error:
??? Undefined variable "NODZ" or class "NODZ".
Error in ==> ThesisMLS at 193
NODZ{F,i}=[3*NODZ{F,i}-2;3*NODZ{F,i}-1;3*NODZ{F,i}];
Although I had identify NODZ in the first loop but it's undefined yet.

Accepted Answer

Image Analyst
Image Analyst on 24 Apr 2013
Evidently your "if" statement never became true so you never got inside to do this line:
NODZ{F,i}(n)=j;
So NODZ is undefined when you try to use it later. I don't know why it didn't become true, all I know is it didn't.

More Answers (0)

Categories

Find more on Argument Definitions in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!