Matlab skips uigetfile upon run, does function upon run section

I call uigetfile from within a script to select a filename to load datafiles.
All of a sudden, Matlab (2013a) appears to skip the line containing uigetfile when I run ('run' command) the script. Strangely enough, when I run only the code section ('run section' command) in which the function containing uigetfile is contained, it does function.
Main script:
%%Load the data to analyse
[data,nFiles,directory] = loadtgadata(directory); % Load the data from the textfiles
Relevant lines in the function:
function [data,nFiles,directory] = loadtgadata(directory)
[files,directory] = uigetfile('*.*','Load TGA data',directory,'MultiSelect','on');
Matlab gives an error upon reaching the next part of the code, which is only logical, since the variable files does not exist.

1 Comment

More significant is the structure of the file containing the script, its name and how you try to call it.
From the command line, try
which yourscriptname
and report on the result. NB that scripts must have m-file names that are legal variable names to Matlab, no spaces and case is significant and stored in a path in the MATLABPATH variable.

Sign in to comment.

Answers (0)

Categories

Find more on App Building in Help Center and File Exchange

Tags

Asked:

on 29 Oct 2013

Commented:

dpb
on 29 Oct 2013

Community Treasure Hunt

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

Start Hunting!