Thread Subject: avoiding loop for defining all elements of a structure ??

Subject: avoiding loop for defining all elements of a structure ??

From: Juliette Salexa

Date: 26 Jul, 2009 22:04:03

Message: 1 of 2

I have a structure with 25 entries:

a(1).start
a(2).start
...
a(25).start

I want to define all of these to be zeros(1,5)

But a(:).start=zeros(1,5) doesn't work

Is there a way to do this WITHOUT loops or converting to cells or matrices ??

Subject: avoiding loop for defining all elements of a structure ??

From: us

Date: 26 Jul, 2009 22:42:02

Message: 2 of 2

"Juliette Salexa" <juliette.physicist@gmail.com> wrote in message <h4ijsj$pq2$1@fred.mathworks.com>...
> I have a structure with 25 entries:
>
> a(1).start
> a(2).start
> ...
> a(25).start
>
> I want to define all of these to be zeros(1,5)
>
> But a(:).start=zeros(1,5) doesn't work
>
> Is there a way to do this WITHOUT loops or converting to cells or matrices ??

a hint:

     help deal;
     help struct; % <- look at the CELL mode

us

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
reference us 26 Jul, 2009 18:44:03
rssFeed for this Thread

Contact us at files@mathworks.com