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.

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