Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Vectorizing Assignment to array of structures?
Date: Sun, 9 Sep 2007 20:49:35 +0000 (UTC)
Organization: Boston University
Lines: 25
Message-ID: <fc1m8v$b6r$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1189370975 11483 172.30.248.38 (9 Sep 2007 20:49:35 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 9 Sep 2007 20:49:35 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 844160
Xref: news.mathworks.com comp.soft-sys.matlab:427571



Hello, 

I have a variable 'data' that is a 1x2 structure array with
the fields in which:

data.times are 5x1 vectors 
data.mean are numbers

I can clearly access the data.mean and data.times values and
manipulate them, but is there a way I can assign each one of
the data.mean values in a vector, quickly, without a loop? 

For instance, let's say I want 

data(1).mean = 5;
data(2).mean = 7;

Is there a way to assign the vector [5 7] to data.mean?
Obviously this example there is only a marginal
computational penalty for doing this somewhat manually, but
for larger arrays of structures, this could be a nightmare.
I'm trying to vectorize this thing as much as possible.

Thanks in advance.