Path: news.mathworks.com!newsfeed-00.mathworks.com!newscon02.news.prodigy.net!prodigy.net!uns-out.usenetserver.com!news.usenetserver.com!pc02.usenetserver.com!fe085.usenetserver.com.POSTED!33b9410e!not-for-mail
From: Doug Schwarz <see@sig.for.address.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: simple struct question
References: <g02nu2$4qt$1@fred.mathworks.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
User-Agent: MT-NewsWatcher/3.5.2 (Intel Mac OS X)
Message-ID: <see-4C362A.20380709052008@softbank060082049208.bbtec.net>
Lines: 27
X-Complaints-To: abuse-news@frontiernet.net
NNTP-Posting-Date: Fri, 09 May 2008 20:38:09 EDT
Organization: Frontier
Date: Fri, 09 May 2008 20:38:07 -0400
Xref: news.mathworks.com comp.soft-sys.matlab:467661


In article <g02nu2$4qt$1@fred.mathworks.com>,
 "jay vaughan" <jvaughan5.nospam@gmail.com> wrote:

> I would like to set all elements for a range of struct
> fields to be the same. What I wanted to write was the
> following, which MATLAB doesn't like.
> 
> A(50:100).f = 5;
> 
> I was hoping not to use a loop for this...
> 
> for k = 50:100,
>     A(k).f = 5;
> end
> 
> 
> Any ideas?
> 
> Thanks,
> J

[A(50:100).f] = deal(5);

-- 
Doug Schwarz
dmschwarz&ieee,org
Make obvious changes to get real email address.