Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: doubts in matlab
Replies: 3   Last Post: Feb 18, 2013 12:00 AM

 Messages: [ Previous | Next ]
 Shobana Posts: 13 Registered: 12/20/12
Re: doubts in matlab
Posted: Feb 17, 2013 10:57 PM

dpb <none@non.net> wrote in message <kfqpf8\$mhc\$1@speranza.aioe.org>...
> On 2/17/2013 5:21 AM, Shobana wrote:
> > Hai...
> > I am tried to find minimum value of particular columns and rows
> > separately but i am getting wrong answers.
> > for example a = [1 2 3 ;
> > 6 5 4;
> > 8 1 7]
> > [x y] = min(a(2:end,2))
> >
> > instead of getting x= 3 y =2 i am getting some other value.how to write
> > correct code for this concept.

>
> a(2:end,2) ==> [5;1] % 2nd to last rows, 2nd column
>
> so you should find [x,y] == [1,2]
>
> Not sure which you were really after that would return your expected
> results otomh I don't see one.
> sorry its not working.its showing me an error
> If you're trying to write a subset of the array and then work min() on
> the 2nd dimension, the ',2' is misplaced above (and you're missing the
> 2nd dimension for the subscript expression if you simply move it.
>
> Try something like
>
> [x ix] = min(a(2:end,:),2)
>
> and see if you can get where you're going from there.
>
> --

Date Subject Author
2/17/13 Shobana
2/17/13 dpb
2/17/13 Shobana
2/18/13 dpb