Thread Subject: Load .dat file while running m-file

Subject: Load .dat file while running m-file

From: S?ren

Date: 28 Oct, 2009 12:30:20

Message: 1 of 3

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

Subject: Load .dat file while running m-file

From: roger

Date: 28 Oct, 2009 12:35:57

Message: 2 of 3

On Oct 28, 1:30 pm, "S?ren " <shenr...@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

Subject: Load .dat file while running m-file

From: Leslie McBrayer

Date: 28 Oct, 2009 17:23:51

Message: 3 of 3

> 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)

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
input Søren 28 Oct, 2009 08:34:22
dat Søren 28 Oct, 2009 08:34:22
load Søren 28 Oct, 2009 08:34:21
rssFeed for this Thread

Contact us at files@mathworks.com