Can I use another filename instead?

1 回表示 (過去 30 日間)
Matlab learner
Matlab learner 2023 年 1 月 30 日
コメント済み: Matlab learner 2023 年 2 月 1 日
If this file is 'image.nii', and it is located at c:\users\matlab,
while using niftiinfo(filename) funtion,
Is it okay to write niftiinfo("c:\users\matlab\image.nii") instead of niftiinfo("image.nii")?

回答 (2 件)

Fangjun Jiang
Fangjun Jiang 2023 年 1 月 30 日
移動済み: Image Analyst 2023 年 1 月 30 日
Yes and it's better.
  1 件のコメント
Matlab learner
Matlab learner 2023 年 2 月 1 日
Thank you!

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


Image Analyst
Image Analyst 2023 年 1 月 30 日
Even more robust:
folder = "c:\users\matlab";
if ~isfolder(folder)
errorMessage = sprintf('Error: folder does not exist:\n', folder);
uiwait(errordlg(errorMessage));
return;
end
fullFileName = fullfile(folder, "image.nii");
if ~isfile(fullFileName)
errorMessage = sprintf('Error: file does not exist:\n', fullFileName);
uiwait(errordlg(errorMessage));
return;
end
% If we get to here, the file exists.
niftiinfo(fullFileName)

カテゴリ

Help Center および File ExchangeDatabase Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by