loading all files from a user specified folder into a gui

조회 수: 2 (최근 30일)
Stephen Devlin
Stephen Devlin 2018년 1월 19일
댓글: Adam 2018년 1월 19일
Hi,
Is there a way for a GUI to allow a user to select a folder of text files on their own computer and have the GUI work on all the txt files within that folder?
Best regards
Steve

채택된 답변

Mahesh
Mahesh 2018년 1월 19일
x = uigetfile({'*.txt'});
fid = fopen(x);

추가 답변 (1개)

Matt J
Matt J 2018년 1월 19일
편집: Matt J 2018년 1월 19일
  댓글 수: 1
Adam
Adam 2018년 1월 19일
Combined with something like:
info = dir( folder );
filenames = { info.name };
[~,~,ext] = cellfun( @fileparts, filenames , 'UniformOutput', false )
txtIdx = strcmp( ext, { '.txt' } )
filenames = filenames( txtIdx )
to give you all the filenames of the desired type from the directory.

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

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by