how to plot specific column from a matrix

조회 수: 20 (최근 30일)
Josh Tsai
Josh Tsai 2022년 1월 12일
댓글: KSSV 2022년 1월 12일
Hello everyone, I have a 349525 x 4 double matrix, if I try to plot the graph of column 1 vs column 4, what should my command be. I've tried plot(M(:,1),M(:,4)) already and it didn't work out. Any help will be much appreciated. Thank you.

답변 (1개)

KSSV
KSSV 2022년 1월 12일
A = rand(100,4) ;
plot(A(:,1),A(:,4)) % plot 1 column w.r.t. 4 column
If this is not working. Show us the full error or tell us how the plot is.
  댓글 수: 2
Josh Tsai
Josh Tsai 2022년 1월 12일
Hello KSSV, yes, this is working but I don't think this answered my question. I was looking for the method of selecting 2 columns (coulmn 1 and 4) from a matrix and plot it while column 4 is on the x-axis and column 1 is on the y-axis
KSSV
KSSV 2022년 1월 12일
A = rand(100,4) ;
plot(A(:,4),A(:,1))

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by