Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
Ian
Posts:
14
Registered:
9/21/10
|
|
Re: Quick Problem (sorting data)
Posted:
Sep 30, 2010 6:24 AM
|
|
"Jos (10584) " <#10584@fileexchange.com> wrote in message <i81jtr$bm6$1@fred.mathworks.com>... > "Ian " <ikirby23@yahoo.com> wrote in message <i81j9m$27e$1@fred.mathworks.com>... > > In matlab how would I locate the values from (g) using the values from (f) and create them as a seperate variable (h): > > > > g=[ 7 2520 > > 8 2375 > > 10 3618 > > 12 2694 > > 14 2158 > > 15 2842] > > > > f=[2520;3618;2842] > > > > The variable I would want to create from (g) using (f) would be: > > > > h=[7 2520 > > 10 3618 > > 15 2842] > > > > I acknowledge this is probably a very straight foward excercise, but I have only really started using matlab and cannot seem to find a way of doing these on the help guide. I know this could be done just by creating a new variable by simply typing the new vaules in as shown in (h), but the data set I have is very much larger than the example shown here. > > help ISMEMBER > use the last column of g as one of its input and use the output to logically index into g. > > hth > Jos
Right so I would create a variable from (g) using the last column:a=g(:,2); and use this as an input and use (f) as an output. How would I then logically index this into (g)?
|
|
|
Date
|
Subject
|
Author
|
|
9/30/10
|
|
Ian
|
|
9/30/10
|
|
Jos
|
|
9/30/10
|
|
Ian
|
|
9/30/10
|
|
Ian
|
|
9/30/10
|
|
Jos
|
|
9/30/10
|
|
Ian
|
|
|