Open multiple file as string

조회 수: 1 (최근 30일)
Fredic
Fredic 2020년 4월 10일
댓글: Fredic 2020년 4월 20일
Hi guys,
I have a question.
I have different file like string, and I want to open it togheter, without write the name
I tryd this code, but in this way I have to write the name of single file.
Have you advice about it?
directory='D:\Documents\numeric\pip\';
fittingresultspath = 'D:\Documents\numeric\fitting_results\pip\';
fid = -1; msg = ''; while fid < 0
disp(msg); filename = input('input: ','s'); fid=1;
end
Thank you so much
  댓글 수: 8
Geoff Hayes
Geoff Hayes 2020년 4월 11일
Are all of the files in the same folder (see dir)? Different folders? Do you want the user to choose the file (see uigetfile)?
Fredic
Fredic 2020년 4월 12일
The files are in the same folder and I want to consider all the files and not choose individual files.

댓글을 달려면 로그인하십시오.

채택된 답변

Geoff Hayes
Geoff Hayes 2020년 4월 13일
FC - try the following
folderName = '/Users/somename/somepath'; % example folder that has files we are interested in
filesInFolder= dir(folderName);
for k = 1:length(filesInFolder)
fprintf('file name: %s\n',filesInFolder(k).name);
% do something with this file
end
  댓글 수: 8
Fredic
Fredic 2020년 4월 20일
thanks!!
Fredic
Fredic 2020년 4월 20일
"Accept this answer at the top of the answer to actually accept it." It does not appers this possibility

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by