Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to assign a vector to a structure?
Date: Mon, 15 Jun 2009 21:19:04 +0000 (UTC)
Organization: Xoran Technologies
Lines: 9
Message-ID: <h16ds8$bg2$1@fred.mathworks.com>
References: <h141it$d34$1@fred.mathworks.com> <h14r4d$9vh$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1245100744 11778 172.30.248.35 (15 Jun 2009 21:19:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 15 Jun 2009 21:19:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:547688


"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <h14r4d$9vh$1@fred.mathworks.com>...

> If your struct exists already, assign in one shot can be done by:
> 
> c=num2cell(numbers); [myStruct.electrode(1:10).number]=deal(c{:});
> c=num2cell(bankID ); [myStruct.bankID (1:10).number]=deal(c{:});
> clear c

Bruno- I think this will work even if your struct doesn't already exist...?