"Jos (10584) " <#email@example.com> wrote in message <firstname.lastname@example.org>... > "Ian " <email@example.com> wrote in message <firstname.lastname@example.org>... > > 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)?