フィルターのクリア

How to create a series of separate tiff files?

6 ビュー (過去 30 日間)
AA
AA 2024 年 3 月 21 日
回答済み: Walter Roberson 2024 年 3 月 21 日
I am trying to create a new TIFF file to append images to. For some reason this code does not work. I need to create several different tiff files to append different images onto each one.
thresholdarray = [0.01, 0.1, 0.001];
medfiltarray = [2, 8, 10, 16];
for i = 1:3
thresholdvalue = thresholdarray(1,i);
for j = 1:4
medfiltvalue = medfiltarray(1,j);
s1 = 'GFPthreshold:';
s2 = num2str(thresholdvalue);
s3 = 'medfilt:';
s4 = num2str(medfiltvalue);
s5 = '.tif';
tiffname = strcat(s1,s2,s3,s4,s5);
tiff = Tiff(tiffname,'a');
end
end
%%this line of code works:
tiff = Tiff('newtiff.tif','a'); %this creates a new tiff file in my file path
% why doesn't the loop work?

採用された回答

Walter Roberson
Walter Roberson 2024 年 3 月 21 日
Your filename includes a colon . colon is not a valid character in a filename for Windows (other than for drive letter) or MacOS

その他の回答 (1 件)

Chunru
Chunru 2024 年 3 月 21 日
編集済み: Chunru 2024 年 3 月 21 日
It works here (in a unix environment). You may want to change ":" in file names into "_" for windows.
thresholdarray = [0.01, 0.1, 0.001];
medfiltarray = [2, 8, 10, 16];
for i = 1:3
thresholdvalue = thresholdarray(1,i);
for j = 1:4
medfiltvalue = medfiltarray(1,j);
s1 = 'GFPthreshold:';
s2 = num2str(thresholdvalue);
s3 = 'medfilt:';
s4 = num2str(medfiltvalue);
s5 = '.tif';
tiffname = strcat(s1,s2,s3,s4,s5);
tiff = Tiff(tiffname,'a');
end
end
dir
. GFPthreshold:0.001medfilt:16.tif GFPthreshold:0.01medfilt:10.tif GFPthreshold:0.01medfilt:8.tif GFPthreshold:0.1medfilt:2.tif .. GFPthreshold:0.001medfilt:2.tif GFPthreshold:0.01medfilt:16.tif GFPthreshold:0.1medfilt:10.tif GFPthreshold:0.1medfilt:8.tif GFPthreshold:0.001medfilt:10.tif GFPthreshold:0.001medfilt:8.tif GFPthreshold:0.01medfilt:2.tif GFPthreshold:0.1medfilt:16.tif

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

タグ

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by