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!