Can I use another filename instead?

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일

1 개 추천

Yes and it's better.
Image Analyst
Image Analyst 2023년 1월 30일

0 개 추천

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)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

질문:

2023년 1월 30일

댓글:

2023년 2월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by