how to apply if else condition within for loop having cell(each cell containing 4 element) of matrix in matlab.
조회 수: 2 (최근 30일)
이전 댓글 표시
how to apply if else condition within for loop having cell(each cell containing 4 element) of matrix in matlab.
댓글 수: 0
답변 (1개)
Mischa Kim
2014년 3월 12일
편집: Mischa Kim
2014년 3월 12일
Biswajit, does this help?
C = {[1 2 3 4], [11 22], [1 2], [11 22 33 44]};
for ii = 1:numel(C) % loop through all four cells
if length(C{ii}) == ii % does ith cell contain i numbers?
disp('Yep')
else
disp('Nope')
end
end
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!