MATLAB Answers

Reformating cell array of chars

1 view (last 30 days)
MiauMiau on 25 Mar 2017
Edited: Jan on 25 Mar 2017
What I want is the following: I have 4D-files, I want to extract the names of the 3d slices in these files. Say I have a 4D file, which consists of three such slices, I would like to have the names of these slices as follows:
a = {
This gives me here a 3x1 cell. If there are many such slices, doing this manually is of course quite difficult. There is a function which recursively finds the name of the slices of 4D volumes in a folder, however it gives back a char array, e.g.:
My question: How can I convert this char array in the format above, e.g. into a 3x1 cell containing the names? It should be as automated as possible (sometimes there might be 200 slices, sometimes 300 etc.)

Answers (1)

Jan on 25 Mar 2017
Edited: Jan on 25 Mar 2017
If the function replies a char array, simply use:
a = cellstr(c)
I guess, that it is easy to write a function, which finds the file names:
DirList = dir('/myComputer/*.nii,*');
FileList = fullfile('/myComputer/', {});

Community Treasure Hunt

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

Start Hunting!