From: S?ren on
Hi,
I would like to load a .dat file while running a m-file,
my problem is not how to make the program load a specific file, but to make
the program ask for an input, where I choose wich file to run.
I have tried the code:

load input(['comment'])

but matlab give me the error
??? Error using ==> load
Unable to read file input(['comment']): No such file or directory.

Error in ==> testloadmatrix at 11
load input(['comment']);

Anyone know what I should do?

Regards S?ren
From: roger on
On Oct 28, 1:30 pm, "S?ren " <shenr...(a)student.aau.dk> wrote:
> Hi,
> I would like to load a .dat file while running a m-file,
> my problem is not how to make the program load a specific file, but to make
> the program ask for an input, where I choose wich file to run.
> I have tried the code:
>
> load input(['comment'])
>
> but matlab give me the error
> ??? Error using ==> load
> Unable to read file input(['comment']): No such file or directory.
>
> Error in ==> testloadmatrix at 11
> load input(['comment']);
>
> Anyone know what I should do?
>
> Regards S?ren

>> help uigetfile
From: Leslie McBrayer on
> I have tried the code:
>
> load input(['comment'])
>
> but matlab give me the error
> ??? Error using ==> load
> Unable to read file input(['comment']): No such file or directory.

For a variable filename, you need to use function syntax for load, rather
than command syntax. For example:

filename = uigetfile;
load(filename)