How to use uigetfile to open subfolder's file.

How to use uigetfile to open the .txt in the subfolder.
Or there are other ways to use this.
[file,filepath] = uigetfile('*.txt');
WISETEST = fopen( file, 'rt');
out = textscan(WISETEST, '%s', 'Delimiter',{' '});
aa = out{1}(1:end)';
it seems to only open the .txt in the current directory.

 Accepted Answer

[file,filepath] = uigetfile('*.txt');
if isempty(file); return; end %user cancel
fullname = fullfile(filepath, file);
WISETEST = fopen( fullname, 'rt');
out = textscan(WISETEST, '%s', 'Delimiter',{' '});
fclose(WISETEST);
aa = out{1}(1:end)';

More Answers (0)

Categories

Find more on App Building in Help Center and File Exchange

Asked:

on 15 Nov 2019

Commented:

on 15 Nov 2019

Community Treasure Hunt

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

Start Hunting!