for loop
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
if size(qq)==[1,8]
ff=[(hh(1,1)+qq(1,2))];
ff1=[(hh(1,1)+qq(1,4))];
ff2=[(hh(1,1)+qq(1,6))];
ff3=[(hh(1,1)+qq(1,8))];
aa=kk(ff);
aa1=kk(ff1);
aa2=kk(ff2);
aa3=kk(ff3);
elseif size(qq)==[1,6] / size(qq)==[1,7]
ff=[(hh(1,1)+qq(1,2))];
ff1=[(hh(1,1)+qq(1,4))];
ff2=[(hh(1,1)+qq(1,6))];
aa=kk(ff);
aa1=kk(ff1);
aa2=kk(ff2);
elseif size(qq)==[1,4] / size(qq)==[1,5]
ff=[(hh(1,1)+qq(1,2))];
ff1=[(hh(1,1)+qq(1,4))];
aa=kk(ff);
aa1=kk(ff1);
elseif size(qq)==[1,2] / size(qq)==[1,3]
ff=[(hh(1,1)+qq(1,2))];
aa=kk(ff);
end
based on my coding, i want to calculate (aa-aa3) if the size(qq)=[1,8], (aa-aa2) if size(qq)=[1,6], (aa-aa1) of size(qq)=[1,4] and (aa only) if the size(qq)=[1,2]. Is this code correct because im not sure if it works properly.
0 Kommentare
Antworten (1)
Nathan Greco
am 22 Mär. 2012
The only thing that doesn't look right to me is where you have
elseif size(qq)==[1,#] / size(qq)==[1,#+1]
Where # is 6,4,2 Why do you have the second half there? I would get rid of that and just put
elseif size(qq)==[1,#]
And so on. Note: If you wanted to say if size(qq) is less than or equal to [1,3], you would need an | as such:
elseif size(qq)==[1,#] | size(qq)==[1,#+1]
-Nathan
2 Kommentare
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!