how to apply if else condition within for loop having cell(each cell containing 4 element) of matrix in matlab.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
how to apply if else condition within for loop having cell(each cell containing 4 element) of matrix in matlab.
0 Commenti
Risposte (1)
Mischa Kim
il 12 Mar 2014
Modificato: Mischa Kim
il 12 Mar 2014
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 Commenti
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!