Changing Output File Names

2 Ansichten (letzte 30 Tage)
Naomi Gaggi
Naomi Gaggi am 15 Okt. 2018
Kommentiert: Naomi Gaggi am 15 Okt. 2018
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!

Antworten (1)

KSSV
KSSV am 15 Okt. 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
  1 Kommentar
Naomi Gaggi
Naomi Gaggi am 15 Okt. 2018
Hi, thanks! I still am only receiving one output file. I would like to add in a command in which each output file is named differently with each iteration of the loop.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Graph and Network Algorithms finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by