MATLAB Answers

uigetfile

15 views (last 30 days)
nsbd
nsbd on 6 Feb 2012
Edited: Matt J on 1 Oct 2013
loading have in the same folder but fails to sub-folders , why ?
N.Horro = importdata(uigetfile);
tnhks
  2 Comments
Jan
Jan on 6 Feb 2012
What does "fail in subfolders" exactly mean? What do you try and which error message occurs?

Sign in to comment.

Answers (1)

Jan
Jan on 6 Feb 2012
The syntax importdata(uigetfile) catchs only one output from uigetfile. To specify the path, you need to catch the 2nd output also:
[FileName, FilePath] = uigetfile;
if ~ischar(FileName)
disp('User aborted file input.');
return;
end
N.Horro = importdata(fullfile(FilePath, fileName));

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by