how do you create an array of 3d arrays
29 views (last 30 days)
Show older comments
I have a stack of images that are organized by row x column x images in stack to form a 3d array e.g. 10x 10 x 100. This would be 100 frame stack of 10 x 10 images. I need to create an array of them. For example 10 x 10 x 100 x 15 would be 15 image stacks where there are 100 10x10 images in each stack. I've been trying different ways of using the cat function but without any luck.
0 Comments
Answers (2)
Matt J
on 15 Oct 2021
Edited: Matt J
on 15 Oct 2021
I've been trying different ways of using the cat function
You haven't told us in what form the 15 stacks exist now. If you have the stacks as 15 separate variables currently in your workspace then the cat() function is indeed the thing to use, e.g.,
A=cat(4, stack1,stack2,...,stack15)
If you expect to generate these stacks over the course of the loop, you could just pre-allocate the 4D array that will hold them.
A=nan(10,10,100,15);
for i=1:15
A(:,:,:,i)=... %compute something
end
0 Comments
See Also
Categories
Find more on Logical 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!