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

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일
Thank you soooo much
ME
ME 2015년 3월 17일
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 this.. else if (thisRow == rowFromW) do this... else if (thisRow == rowFromU) do this end end end
I would greatly appreciate if you could help me solve this Thank you abundantly
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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

질문:

ME
2015년 3월 16일

댓글:

2015년 3월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by