From 2D image, extract each complete row save as separate index in vector form?

A 2D image of size 50x50, I wants to extract each complete row of image matrix and save it at separate index location if doing with for loop then how to save at each iteration of loop named with same loop variable. If it is possible with some other way please guide me. I don't have much knowledge in using matlab so please guide me Thanks

 Accepted Answer

AsCell = mat2cell(YourImage, ones(1,size(YourImage,1)), size(YourImage,2));
Now AsCell{K} stores the K'th row.
But remember, when you know K you could just have invoked YourImage(K,:) without having to store the rows as separate variables.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!