Question

I have P being a 17x1 cell, each cell representing a subject. Each of the 17 cells within P is a 3x1 cell, representing contrast images for each subject. So basically there are 17 subjects, 3 contrast images per subject. So to index the 3rd contrast images of the 14th subject, I would do P{14,1}{3,1}. However, I would like to turn P into 3*17 x 1 cell (or 51x1 cell) instead. This means there are no nested cells within each cell in P. So P would be something like this:

Subject1/contrast1.img

Subject1/contrast2.img

Subject1/contrast3.img

Subject2/contrast1.img

Subject2/contrast2.img

Subject3/contrast3.img

...

Subject17/contrast3.img

Could anyone tell me how this may be accomplished?

Was it helpful?

Solution

How about a oneliner?

a = {{1;2};{3;4};{5;6};{7;8}}
b = vertcat(a{:})
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top