Prev: Plotting a linear trend line using "tools", "basic fitting"
Next: My program is somewhat doing what I ask, but not to the extant I want
From: Aaron Anstey on 10 Aug 2010 15:43 I have a matrix of two columns, the first column contains a range of numbers and so does the second column. When the value in the first column is "50", I want Matlab to output the corresponding value for that row in the second column. Can anyone please tell me the command I can use for this? Many thanks.
From: dpb on 10 Aug 2010 15:45 Aaron Anstey wrote: > I have a matrix of two columns, the first column contains a range of > numbers and so does the second column. When the value in the first > column is "50", I want Matlab to output the corresponding value for that > row in the second column. Can anyone please tell me the command I can > use for this? Many thanks. doc find --
From: Andy on 10 Aug 2010 15:51 "Aaron Anstey" <elaja2(a)lboro.ac.uk> wrote in message <i3sa4a$c7m$1(a)fred.mathworks.com>... > I have a matrix of two columns, the first column contains a range of numbers and so does the second column. When the value in the first column is "50", I want Matlab to output the corresponding value for that row in the second column. > Can anyone please tell me the command I can use for this? > Many thanks. Does "output" mean at the command line? >> a=[(1:100)' rand(100,1)]; % sample data >> a(a(:,1)==50,2) % outputs the second column where the first column is 50
From: machatsk on 10 Aug 2010 15:51 "Aaron Anstey" <elaja2(a)lboro.ac.uk> wrote in message <i3sa4a$c7m$1(a)fred.mathworks.com>... > I have a matrix of two columns, the first column contains a range of numbers and so does the second column. When the value in the first column is "50", I want Matlab to output the corresponding value for that row in the second column. > Can anyone please tell me the command I can use for this? > Many thanks. matrix(50,2) %gets value of 50th row, 2nd column Maxx
From: Aaron Anstey on 10 Aug 2010 16:31
"Andy " <myfakeemailaddress(a)gmail.com> wrote in message <i3saj9$cpq$1(a)fred.mathworks.com>... > "Aaron Anstey" <elaja2(a)lboro.ac.uk> wrote in message <i3sa4a$c7m$1(a)fred.mathworks.com>... > > I have a matrix of two columns, the first column contains a range of numbers and so does the second column. When the value in the first column is "50", I want Matlab to output the corresponding value for that row in the second column. > > Can anyone please tell me the command I can use for this? > > Many thanks. > > Does "output" mean at the command line? > > >> a=[(1:100)' rand(100,1)]; % sample data > >> a(a(:,1)==50,2) % outputs the second column where the first column is 50 Many thanks, this works. |