2D plot of a matrix

조회 수: 5 (최근 30일)
aurc89
aurc89 2020년 3월 25일
댓글: KSSV 2020년 3월 26일
Hello,
I have a matrix (txt file) as the one in the pictures, with different columns (A to G). Each of these columns can be plot separately as a chart of points.
What I would like to do is:
1) for each column, subtract the offset from zero level (like a horizontal baseline);
2) plot as a map all these data, like if they are seen from the "top" one close to the other, with the label A, B, C...G. They should be normalized to the highest value of the matrix (for example, with a colorbar from 0 to 1, the "1" color corresponds to the highest value of the matrix).
Thanks

채택된 답변

KSSV
KSSV 2020년 3월 25일
Read about importdata to load the data into MATLAB.
You can normalize an array x to [0,1] using:
norm_x = (x-min(x))/(max(x)-min(x)) ;
To plot use plot.
  댓글 수: 2
aurc89
aurc89 2020년 3월 25일
Thanks. But when I use importdata I have this matrix imported as a struct, so how can I plot this?
for example a=importdata(try.txt), then a is a struct, I cannot use plot(a)
KSSV
KSSV 2020년 3월 26일
yes..a will have text and data. You can pick data using:
a = a.data ;
YOu can load data using load, textscan also.

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

추가 답변 (0개)

카테고리

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