MATLAB Answers

loading all files from a user specified folder into a gui

조회 수: 3(최근 30일)
Stephen Devlin
Stephen Devlin 19 Jan 2018
댓글: Adam 19 Jan 2018
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

  댓글 수: 0

로그인 to comment.

채택된 답변

Mahesh
Mahesh 19 Jan 2018
x = uigetfile({'*.txt'});
fid = fopen(x);

  댓글 수: 0

로그인 to comment.

추가 답변(1개)

Matt J
Matt J 19 Jan 2018
편집: Matt J 19 Jan 2018

  댓글 수: 1

Adam
Adam 19 Jan 2018
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.

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.

태그


Translated by