how to plot a specific column of a matrix

hi there , i have a 115340*3 matrix i want to plot just the second column of it, how can i do that ? any help would be appreciated.

回答 (2 件)

Mischa Kim
Mischa Kim 2014 年 7 月 24 日
編集済み: Mischa Kim 2014 年 7 月 24 日

6 投票

Amin, use
plot(mymat(:,2))
where mymat is the matrix.

5 件のコメント

Amin
Amin 2014 年 7 月 24 日
tq dear Mischa , it works ;) and another Q is that how can i plot the 2nd & 3rd column in a x-y axis ? u know , the 3rd column base on 2nd column ?
Michael
Michael 2014 年 7 月 24 日
maybe you can try:
plot(mymat(:,2),mymat(:,3));
Michael
Michael 2014 年 7 月 24 日
this plots the 2nd column on the x-axis and 3rd column on the y-axis...is that what you meant?
Amin
Amin 2014 年 7 月 24 日
unfortunately not ,
all i need is just s.th like this image
Amin
Amin 2014 年 7 月 24 日
and what i got from ur cmnd is like this

サインインしてコメントする。

Michael Haderlein
Michael Haderlein 2014 年 7 月 24 日

0 投票

That looks as if your data is not sorted. Either you don't plot the lines
plot(...,'.')
or you sort beforehand:
[sort1,ind]=sort(matrix(:,2));
sort2=matrix(ind,3);
plot(sort1,sort2)
Best regards,
Michael

カテゴリ

質問済み:

2014 年 7 月 24 日

回答済み:

2014 年 7 月 24 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by