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)]

 Accepted Answer

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.

More Answers (0)

Categories

Find more on Parallel Computing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!