Path: news.mathworks.com!not-for-mail
From: "John D'Errico" <woodchips@rochester.rr.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Subscript indices
Date: Tue, 17 Feb 2009 13:11:02 +0000 (UTC)
Organization: John D'Errico (1-3LEW5R)
Lines: 37
Message-ID: <gned16$icr$1@fred.mathworks.com>
References: <gne9b2$46o$1@fred.mathworks.com> <gnearq$hnu$1@fred.mathworks.com> <gnecam$1jv$1@fred.mathworks.com>
Reply-To: "John D'Errico" <woodchips@rochester.rr.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1234876262 18843 172.30.248.37 (17 Feb 2009 13:11:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 17 Feb 2009 13:11:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869215
Xref: news.mathworks.com comp.soft-sys.matlab:518828


"S?bastien Vilaseca" <seb2000@bluewin.ch> wrote in message <gnecam$1jv$1@fred.mathworks.com>...
> "Jos " <#10584@fileexchange.com> wrote in message <gnearq$hnu$1@fred.mathworks.com>...
> > "S?bastien Vilaseca" <seb2000@bluewin.ch> wrote in message <gne9b2$46o$1@fred.mathworks.com>...
> > > Hi,
> > > I have the following loop:
> > > 
> > > for x=[0.001:0.001:0.1]
> > > result(x)=y;
> > > end
> > > 
> > > The problem is that I get the following error message: "Subscript indices must either be real positive integers or logicals". So is there a way I can make it without that error?
> > 
> > What is "it" in ".. so I can make it ..."?
> > 
> > Jos
> 
> So I can find the solution :).

You cannot do so. MATLAB does not allow you to
index a matrix with non-positive integer indices.
At least not unless you define your own objects,
then explicitly define how subsref and subsasgn
work.

You can do an assignment like this:

result(1) = stuff;

you cannot do this

result(0.001) = stuff;

Just wanting to do something will not make it so.
I believe the old phrase was "If wishes were horses,
beggars would ride."

John