Changing Output File Names

2 ビュー (過去 30 日間)
Naomi Gaggi
Naomi Gaggi 2018 年 10 月 15 日
コメント済み: Naomi Gaggi 2018 年 10 月 15 日
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!

回答 (1 件)

KSSV
KSSV 2018 年 10 月 15 日
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 件のコメント
Naomi Gaggi
Naomi Gaggi 2018 年 10 月 15 日
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.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGraph and Network Algorithms についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by