Can I use another filename instead?

1 次查看(过去 30 天)
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.

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 CenterFile Exchange 中查找有关 Database Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by