Cellstr error in my program: Where is my mistake?
Afficher commentaires plus anciens
Hi, My program is the following:
s = dir('./sub*/*.*');
for kk = 1:numel(s);
if ~s(kk).isdir
dicomfiles = 1:numel('./sub*/*.*');
fd=spm_file(dicomfiles(1,:), 'fpath');
cd(fd);
hdr=spm_dicom_headers(dicomfiles);
spm_dicom_convert(hdr, 'all', 'series', 'nii')
else
end
msgbox ('done' , 'OK')
end
I am trying to get the program to read all folders containing the word sub and then in each folder convert the files and then loop to go through each folder, then the files, etc.
I am currently getting the errors:
Error using cellstr (line 49)
Conversion to cellstr from double is not possible.
Error in spm_file (line 63)
str = cellstr(str);
Error in LoopDcmConv (line 5)
fd=spm_file(dicomfiles(1,:), 'fpath');
Would someone be able to tell me where to change the program to make it run properly?
2 commentaires
Jos (10584)
le 4 Oct 2018
This is strange as it will always return the array [1 2 ... 10]
1:numel('./sub*/*.*')
so, the next line will return a strange character array
Naomi Gaggi
le 4 Oct 2018
Réponses (0)
Catégories
En savoir plus sur Cell Arrays dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!