フィルターのクリア

how to apply if else condition within for loop having cell(each cell containing 4 element) of matrix in matlab.

2 ビュー (過去 30 日間)
Biswajit
Biswajit 2014 年 3 月 12 日
編集済み: Mischa Kim 2014 年 3 月 12 日
how to apply if else condition within for loop having cell(each cell containing 4 element) of matrix in matlab.

回答 (1 件)

Mischa Kim
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

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by