Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
the load function and strings

Subject: the load function and strings

From: Widt

Date: 15 May, 2011 09:05:04

Message: 1 of 3

Hi.

I want to load a series of data by using a loop like this:

files = [{'file1'} {'file2'} {'file3'}];
for v=1:3
load(files(1,v))
end

this does not work for me, I get an error message saying that the load function needs a string.

How can I do this? could someone please help me ?

Subject: the load function and strings

From: Nasser M. Abbasi

Date: 15 May, 2011 09:24:17

Message: 2 of 3

On 5/15/2011 2:05 AM, Widt wrote:
> Hi.
>
> I want to load a series of data by using a loop like this:
>
> files = [{'file1'} {'file2'} {'file3'}];
> for v=1:3
> load(files(1,v))
> end
>
> this does not work for me, I get an error message saying that the load function needs a string.
>
> How can I do this? could someone please help me ?

try

for v=1:3
  load( char( files(v) ) )
end

--Nasser

Subject: the load function and strings

From: Widt

Date: 15 May, 2011 09:51:02

Message: 3 of 3

"Nasser M. Abbasi" <nma@12000.org> wrote in message <iqo64a$k8o$1@speranza.aioe.org>...
> On 5/15/2011 2:05 AM, Widt wrote:
> > Hi.
> >
> > I want to load a series of data by using a loop like this:
> >
> > files = [{'file1'} {'file2'} {'file3'}];
> > for v=1:3
> > load(files(1,v))
> > end
> >
> > this does not work for me, I get an error message saying that the load function needs a string.
> >
> > How can I do this? could someone please help me ?
>
> try
>
> for v=1:3
> load( char( files(v) ) )
> end
>
> --Nasser


This works.
Thank you Nasser.

Tags for this Thread

No tags are associated with this thread.

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.

Contact us