Need syntax help for creating loop that is dependent on array size
Ältere Kommentare anzeigen
I'm looking to create a loop that runs some calculations for any 2x2 array that is input and generates a warning for any other sized array that is input. If a 3x3 input is entered, i'll need a different warning than if any random size is entered. I'm thinking something like below, but am struggling with the syntax. Thanks in advance
if size(A) = (2 2)
calculations
elseif size(A) = (3 3)
disp('System not designed to evaluate 3x3 matrices')
elseif size(A) ~= (2 2,3 3)
disp('An invalid array has been entered')
Akzeptierte Antwort
Weitere Antworten (1)
Jan
am 26 Nov. 2012
See:
if isequal(size(A), [2, 2])
Kategorien
Mehr zu Structures finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!