Cellstr error in my program: Where is my mistake?
이전 댓글 표시
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
Jos (10584)
2018년 10월 4일
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
2018년 10월 4일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Variables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!