필터 지우기
필터 지우기

How to import a specific file

조회 수: 7 (최근 30일)
Shane
Shane 2012년 12월 19일
I know how to import a specific file, but what if matlab has two folders set as pathways to check of which both have same filename and filetype, identical.
example: "example.txt"
and their in both folders, and if you importdata('example.txt');
I assume that will just select one of them depending on whichever it encounters first.
Is there a way to select the file through some function I am unaware of?
Cheers, Shane

채택된 답변

Image Analyst
Image Analyst 2012년 12월 19일
Use fullfile() to specify the folder and full file name (path + base file name + extension) of the one you want to import.
fullFileName = fullfile(folder1, 'example.txt');
if exist(fullFileName, 'file')
csvread(fullFileName);
else
message = sprintf('Warning: %s does not exist', fullFileName);
uiwait(warndlg(message));
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 NaNs에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by