how can i create a loop which reads rows in an array?

1 回表示 (過去 30 日間)
ME
ME 2015 年 3 月 16 日
コメント済み: Image Analyst 2015 年 3 月 17 日
I want to create a loop which read each row in an array. the array have dimensions of 90x2.

採用された回答

Image Analyst
Image Analyst 2015 年 3 月 17 日
[rows, columns] = size(array);
for row = 1 : rows
thisRow = array(row, :) % No ; so it will echo to command window.
% Now do something with thisRow.....
end
  4 件のコメント
ME
ME 2015 年 3 月 17 日
going to write it out neatly so its easier to read
I have three more arrays w, u and v they all have some elements from the array but w, u and v are all unique so do not have matching rows.
I want to be able to set the condition in this loop so that
if (thisRow == rowFromV) do something ..
else if (thisRow == rowFromW) do something...
else if (thisRow == rowFromU) do something
end end end
Image Analyst
Image Analyst 2015 年 3 月 17 日

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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