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

 Respuesta aceptada

[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 comentarios

ME
ME el 17 de Mzo. de 2015
Thank you soooo much
ME
ME el 17 de Mzo. de 2015
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 el 17 de Mzo. de 2015
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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

ME
el 16 de Mzo. de 2015

Comentada:

el 17 de Mzo. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by