Need syntax help for creating loop that is dependent on array size
이전 댓글 표시
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')
채택된 답변
추가 답변 (1개)
Jan
2012년 11월 26일
See:
if isequal(size(A), [2, 2])
카테고리
도움말 센터 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!