How can I convert a 3 dimensional matrix into a single cell
7 views (last 30 days)
Show older comments
bhavya vendra
on 19 Apr 2016
Answered: Image Analyst
on 20 Apr 2016
How can I convert a 3d matrix into a cell array with 1*1 dimension which would then open the 3 dimensional matrix
2 Comments
James Tursa
on 19 Apr 2016
I don't understand what "would then open the 3 dimensional matrix" means. Can you give a short example? E.g., suppose you had a 4x3x2 array ... what would your cell array look like?
Accepted Answer
Image Analyst
on 20 Apr 2016
Already answered in your duplicate question: http://www.mathworks.com/matlabcentral/answers/279904-converting-3d-image-stack-to-a-1-1-cell-array
0 Comments
More Answers (1)
Kelly Kearney
on 19 Apr 2016
Is this what you want?
x = rand(4,3,2);
x = {x};
2 Comments
Kelly Kearney
on 20 Apr 2016
I assume a is supposed to be a 3D matrix? Right now, you're overwriting the data on each iteration of the loop. Instead, save each image to a single slice of the matrix:
a = zeros(1024,1024,N);
for ii = 1:N
a(:,:,ii) = imread(sprintf(FNAMFMT, ii));
end
See Also
Categories
Find more on Resizing and Reshaping Matrices 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!