<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/244698</link>
    <title>MATLAB Central Newsreader - Subscript indices</title>
    <description>Feed for thread: Subscript indices</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Tue, 17 Feb 2009 12:08:02 -0500</pubDate>
      <title>Subscript indices</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/244698#628826</link>
      <author>S?bastien Vilaseca</author>
      <description>Hi,&lt;br&gt;
I have the following loop:&lt;br&gt;
&lt;br&gt;
for x=[0.001:0.001:0.1]&lt;br&gt;
result(x)=y;&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
The problem is that I get the following error message: &quot;Subscript indices must either be real positive integers or logicals&quot;. So is there a way I can make it without that error?&lt;br&gt;
&lt;br&gt;
Thanks a lot.</description>
    </item>
    <item>
      <pubDate>Tue, 17 Feb 2009 12:13:02 -0500</pubDate>
      <title>Re: Subscript indices</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/244698#628828</link>
      <author>Bruno Luong</author>
      <description>&quot;S?bastien Vilaseca&quot; &amp;lt;seb2000@bluewin.ch&amp;gt; wrote in message &amp;lt;gne9b2$46o$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt; I have the following loop:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; for x=[0.001:0.001:0.1]&lt;br&gt;
&amp;gt; result(x)=y;&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; The problem is that I get the following error message: &quot;Subscript indices must either be real positive integers or logicals&quot;. So is there a way I can make it without that error?&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
No. As the error message tells, Matlab accepts integer indices only (&amp;gt;=1).&lt;br&gt;
&lt;br&gt;
Bruno&lt;br&gt;
&amp;nbsp;</description>
    </item>
    <item>
      <pubDate>Tue, 17 Feb 2009 12:34:02 -0500</pubDate>
      <title>Re: Subscript indices</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/244698#628835</link>
      <author>Jos </author>
      <description>&quot;S?bastien Vilaseca&quot; &amp;lt;seb2000@bluewin.ch&amp;gt; wrote in message &amp;lt;gne9b2$46o$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt; I have the following loop:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; for x=[0.001:0.001:0.1]&lt;br&gt;
&amp;gt; result(x)=y;&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; The problem is that I get the following error message: &quot;Subscript indices must either be real positive integers or logicals&quot;. So is there a way I can make it without that error?&lt;br&gt;
&lt;br&gt;
What is &quot;it&quot; in &quot;.. so I can make it ...&quot;?&lt;br&gt;
&lt;br&gt;
Jos</description>
    </item>
    <item>
      <pubDate>Tue, 17 Feb 2009 12:59:02 -0500</pubDate>
      <title>Re: Subscript indices</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/244698#628841</link>
      <author>S?bastien Vilaseca</author>
      <description>&quot;Jos &quot; &amp;lt;#10584@fileexchange.com&amp;gt; wrote in message &amp;lt;gnearq$hnu$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;S?bastien Vilaseca&quot; &amp;lt;seb2000@bluewin.ch&amp;gt; wrote in message &amp;lt;gne9b2$46o$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Hi,&lt;br&gt;
&amp;gt; &amp;gt; I have the following loop:&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; for x=[0.001:0.001:0.1]&lt;br&gt;
&amp;gt; &amp;gt; result(x)=y;&lt;br&gt;
&amp;gt; &amp;gt; end&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; The problem is that I get the following error message: &quot;Subscript indices must either be real positive integers or logicals&quot;. So is there a way I can make it without that error?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; What is &quot;it&quot; in &quot;.. so I can make it ...&quot;?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Jos&lt;br&gt;
&lt;br&gt;
So I can find the solution :).</description>
    </item>
    <item>
      <pubDate>Tue, 17 Feb 2009 13:06:02 -0500</pubDate>
      <title>Re: Subscript indices</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/244698#628845</link>
      <author>Jos </author>
      <description>&quot;S?bastien Vilaseca&quot; &amp;lt;seb2000@bluewin.ch&amp;gt; wrote in message &amp;lt;gnecam$1jv$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Jos &quot; &amp;lt;#10584@fileexchange.com&amp;gt; wrote in message &amp;lt;gnearq$hnu$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &quot;S?bastien Vilaseca&quot; &amp;lt;seb2000@bluewin.ch&amp;gt; wrote in message &amp;lt;gne9b2$46o$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Hi,&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; I have the following loop:&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; for x=[0.001:0.001:0.1]&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; result(x)=y;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; end&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; The problem is that I get the following error message: &quot;Subscript indices must either be real positive integers or logicals&quot;. So is there a way I can make it without that error?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; What is &quot;it&quot; in &quot;.. so I can make it ...&quot;?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Jos&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; So I can find the solution :).&lt;br&gt;
&lt;br&gt;
Sure! But which solution? &lt;br&gt;
&lt;br&gt;
What should your solution look like? In other words, what is &quot;it&quot;?&lt;br&gt;
&lt;br&gt;
&quot;The largest part of the answer is in asking the right question&quot;&lt;br&gt;
&lt;br&gt;
Jos</description>
    </item>
    <item>
      <pubDate>Tue, 17 Feb 2009 13:11:02 -0500</pubDate>
      <title>Re: Subscript indices</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/244698#628847</link>
      <author>John D'Errico</author>
      <description>&quot;S?bastien Vilaseca&quot; &amp;lt;seb2000@bluewin.ch&amp;gt; wrote in message &amp;lt;gnecam$1jv$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Jos &quot; &amp;lt;#10584@fileexchange.com&amp;gt; wrote in message &amp;lt;gnearq$hnu$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &quot;S?bastien Vilaseca&quot; &amp;lt;seb2000@bluewin.ch&amp;gt; wrote in message &amp;lt;gne9b2$46o$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Hi,&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; I have the following loop:&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; for x=[0.001:0.001:0.1]&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; result(x)=y;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; end&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; The problem is that I get the following error message: &quot;Subscript indices must either be real positive integers or logicals&quot;. So is there a way I can make it without that error?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; What is &quot;it&quot; in &quot;.. so I can make it ...&quot;?&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Jos&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; So I can find the solution :).&lt;br&gt;
&lt;br&gt;
You cannot do so. MATLAB does not allow you to&lt;br&gt;
index a matrix with non-positive integer indices.&lt;br&gt;
At least not unless you define your own objects,&lt;br&gt;
then explicitly define how subsref and subsasgn&lt;br&gt;
work.&lt;br&gt;
&lt;br&gt;
You can do an assignment like this:&lt;br&gt;
&lt;br&gt;
result(1) = stuff;&lt;br&gt;
&lt;br&gt;
you cannot do this&lt;br&gt;
&lt;br&gt;
result(0.001) = stuff;&lt;br&gt;
&lt;br&gt;
Just wanting to do something will not make it so.&lt;br&gt;
I believe the old phrase was &quot;If wishes were horses,&lt;br&gt;
beggars would ride.&quot;&lt;br&gt;
&lt;br&gt;
John</description>
    </item>
    <item>
      <pubDate>Tue, 17 Feb 2009 14:23:52 -0500</pubDate>
      <title>Re: Subscript indices</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/244698#628861</link>
      <author>Andrew</author>
      <description>On Feb 17, 6:06=A0am, &quot;Jos &quot; &amp;lt;#10...@fileexchange.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &quot;S?bastien Vilaseca&quot; &amp;lt;seb2...@bluewin.ch&amp;gt; wrote in message &amp;lt;gnecam$1j...@=&lt;br&gt;
fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &quot;Jos &quot; &amp;lt;#10...@fileexchange.com&amp;gt; wrote in message &amp;lt;gnearq$hn...@fred.ma=&lt;br&gt;
thworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &quot;S?bastien Vilaseca&quot; &amp;lt;seb2...@bluewin.ch&amp;gt; wrote in message &amp;lt;gne9b2$46=&lt;br&gt;
...@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; Hi,&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; I have the following loop:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; for x=3D[0.001:0.001:0.1]&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; result(x)=3Dy;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; end&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; The problem is that I get the following error message: &quot;Subscript i=&lt;br&gt;
ndices must either be real positive integers or logicals&quot;. So is there a wa=&lt;br&gt;
y I can make it without that error?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; What is &quot;it&quot; in &quot;.. so I can make it ...&quot;?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Jos&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; So I can find the solution :).&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Sure! But which solution?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; What should your solution look like? In other words, what is &quot;it&quot;?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &quot;The largest part of the answer is in asking the right question&quot;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Jos&lt;br&gt;
&lt;br&gt;
&quot;Indices&quot; refers to the numbering system matlab uses to access each&lt;br&gt;
element of an array.  If you have an array: x=3D[1, 2, 1, 4, 6, 5, 7];&lt;br&gt;
you can see that there are 7 elements in the array.  So, x(1) is the&lt;br&gt;
first element, and x(7) is the 7th element.  If you asked for x(8),&lt;br&gt;
you would get an error because the array doesn't have 8 elements.  And&lt;br&gt;
if you asked for x(0.1) you would get an error because there cannot be&lt;br&gt;
a non integer index value used to reference one of the elements of the&lt;br&gt;
array.&lt;br&gt;
&lt;br&gt;
On the other hand, if you had the array x =3D [0.001:0.001:1] and you&lt;br&gt;
asked for x(1), you would get the value at x(1) which is 0.001, and x&lt;br&gt;
(2) would be 0.002...etc.</description>
    </item>
    <item>
      <pubDate>Tue, 17 Feb 2009 14:37:02 -0500</pubDate>
      <title>Re: Subscript indices</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/244698#628865</link>
      <author>us</author>
      <description>&quot;S?bastien Vilaseca&quot;&lt;br&gt;
&amp;gt; I have the following loop:&lt;br&gt;
&amp;gt; for x=[0.001:0.001:0.1]&lt;br&gt;
&amp;gt; result(x)=y;&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; The problem is that I get the following error message: &quot;Subscript indices must either be real positive integers or logicals&quot;. So is there a way I can make it without that error...&lt;br&gt;
&lt;br&gt;
yes, peruse this great intro by steve eddins and loren shure&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/company/newsletters/digest/sept01/matrix.html&quot;&gt;http://www.mathworks.com/company/newsletters/digest/sept01/matrix.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
us</description>
    </item>
    <item>
      <pubDate>Fri, 20 Feb 2009 12:09:02 -0500</pubDate>
      <title>Re: Subscript indices</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/244698#629678</link>
      <author>Bruno Luong</author>
      <description>&quot;S?bastien Vilaseca&quot; &amp;lt;seb2000@bluewin.ch&amp;gt; wrote in message &amp;lt;gne9b2$46o$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt; I have the following loop:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; for x=[0.001:0.001:0.1]&lt;br&gt;
&amp;gt; result(x)=y;&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; The problem is that I get the following error message: &quot;Subscript indices must either be real positive integers or logicals&quot;. So is there a way I can make it without that error?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks a lot.&lt;br&gt;
&lt;br&gt;
Actually you could do this:&lt;br&gt;
&lt;br&gt;
x=[0.001:0.001:0.1];&lt;br&gt;
result=containers.Map(inf,inf); % create with dummy&lt;br&gt;
for x=[0.001:0.001:0.1]&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;y=rand();&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;result(x)=y;&lt;br&gt;
end&lt;br&gt;
remove(result,Inf); % remove the dummy&lt;br&gt;
&lt;br&gt;
x=0.002&lt;br&gt;
result(x) % beware of floating-point limited precision...&lt;br&gt;
&lt;br&gt;
% Bruno</description>
    </item>
  </channel>
</rss>

