how can i put the following code into a nested FOR loops

Hi, how can i put the following code into a nested FOR loops?
xu = [0:1];
yu = [0:1]';
[X, Y] = meshgrid(xu,yu);
prx(:,1) = [X(1,1); Y(1,1)]
prx(:,2) = [X(2,1); Y(2,1)]
prx(:,3) = [X(1,2); Y(1,2)]
prx(:,4) = [X(2,2); Y(2,2)]

 Respuesta aceptada

John D'Errico
John D'Errico el 18 de Mzo. de 2017
Editada: John D'Errico el 18 de Mzo. de 2017
Why would you want to use a for loop at all, when one line suffices for anything that you would loop over?
prx = [X(:),Y(:)];
Using nested loops to do this seems to be an abuse of MATLAB.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 18 de Mzo. de 2017

Comentada:

el 19 de Mzo. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by