[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: manipulation of matrix elements

**From**: |
Mike Miller |

**Subject**: |
Re: manipulation of matrix elements |

**Date**: |
Thu, 16 Dec 1999 10:41:06 -0600 (CST) |

On Thu, 16 Dec 1999, John W. Eaton wrote:
>* On 16-Dec-1999, Michael Roth <address@hidden> wrote:*
>* *
>* | I tried to set a lower limit for matrix elements using the find command.*
>* | I think there is a bug. Have a look at the following lines: *
>* | *
>* | s=rand(2)*
>* | s =*
>* | 0.47926 0.89733*
>* | 0.77293 0.02806*
>* | *
>* | >> [i,j]=find(s<=0.5)*
>* | i =*
>* | 1*
>* | 2*
>* | *
>* | j =*
>* | 1*
>* | 2*
>* | *
>* | *
>* | >> s(i,j)=0.5 | In Matlab, this command gives *
>* | s = | s = *
>* | 0.50000 0.50000 | 0.50000 0.89733*
>* | 0.50000 0.50000 | 0.77293 0.50000*
>* *
>* What version of Matlab does this?*
>* *
>* If Matlab *does* behave this way, I think it is a bug in Matlab*
I'm using 5.2.0.3084 under Win NT and it does *not* do what Michael Roth
reported. It does what he attributes to octave, which is the correct
behavior, I think.
s(i,j) should take the rows from s given by the values in i, and it should
take the columns from s given by the values in j. So, in the example
above, s(i,j) should return all .5's.
Mike
--
Michael B. Miller
University of Missouri--Columbia
http://taxa.psyc.missouri.edu/~mbmiller/
-----------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.che.wisc.edu/octave/octave.html
How to fund new projects: http://www.che.wisc.edu/octave/funding.html
Subscription information: http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------