Changing Output File Names
2 views (last 30 days)
Show older comments
I wrote the program:
a = {'path1'};
b = {'path2'};
c = {'path3'};
s_out = {'/Users/Desktop/output'};
for i = [a,b,c]
kk = 1:length(i);
t = spm_select('FPList', i(kk), '.*');
hdr = spm_dicom_headers(t);
spm_dicom_convert(hdr, 'all', 'flat', 'nii', char(s_out));
end
The output files are coming out as the same and overwriting each other, so I am only seeing 1 file in the output folder. I want three files to be put into the output directory with three different names, including 1, 2, 3, etc. I have been trying to solve this for a while, but can't seem to figure out how to write this command. Thanks!
0 Comments
Answers (1)
KSSV
on 15 Oct 2018
a = {'path1'};
b = {'path2'};
c = {'path3'};
s_out = {'/Users/Desktop/output'};
s = [a,b,c] ;
for kk = 1:length(s)
t = spm_select('FPList', s(kk), '.*');
hdr = spm_dicom_headers(t);
spm_dicom_convert(hdr, 'all', 'flat', 'nii', char(s_out));
end
See Also
Categories
Find more on Graph and Network Algorithms 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!