I want to plot selected data from rows and columns

조회 수: 34 (최근 30일)
HAMBA IVAN
HAMBA IVAN 2022년 11월 9일
댓글: HAMBA IVAN 2022년 11월 9일
I have data in a table and i want to plot first column (row 256 to 345) as X against second column (row 256 to 345) as Y. I need help

답변 (3개)

Torsten
Torsten 2022년 11월 9일
편집: Torsten 2022년 11월 9일
Plotting the second against the first column does not make much sense because the first column is the year and the second column is the month of the year, but here we go:
A = readmatrix("https://de.mathworks.com/matlabcentral/answers/uploaded_files/1186758/SN_m_tot_V2.0.txt");
plot(A(256:345,1),A(256:345,2))

KSSV
KSSV 2022년 11월 9일
T = readtable('https://in.mathworks.com/matlabcentral/answers/uploaded_files/1186758/SN_m_tot_V2.0.txt') ;
scatter3(T.(1),T.(2),T.(3),[],T.(3))

Hiro Yoshino
Hiro Yoshino 2022년 11월 9일
편집: Hiro Yoshino 2022년 11월 9일
Let me use the ulr info like @KSSV @Torsten did!!
Here you are:
data = readtable("https://www.mathworks.com/matlabcentral/answers/uploaded_files/1186758/SN_m_tot_V2.0.txt")
data = 3286×7 table
Var1 Var2 Var3 Var4 Var5 Var6 Var7 ____ ____ ______ _____ ____ ____ __________ 1749 1 1749 96.7 -1 -1 {0×0 char} 1749 2 1749.1 104.3 -1 -1 {0×0 char} 1749 3 1749.2 116.7 -1 -1 {0×0 char} 1749 4 1749.3 92.8 -1 -1 {0×0 char} 1749 5 1749.4 141.7 -1 -1 {0×0 char} 1749 6 1749.5 139.2 -1 -1 {0×0 char} 1749 7 1749.5 158 -1 -1 {0×0 char} 1749 8 1749.6 110.5 -1 -1 {0×0 char} 1749 9 1749.7 126.5 -1 -1 {0×0 char} 1749 10 1749.8 125.8 -1 -1 {0×0 char} 1749 11 1749.9 264.3 -1 -1 {0×0 char} 1749 12 1750 142 -1 -1 {0×0 char} 1750 1 1750 122.2 -1 -1 {0×0 char} 1750 2 1750.1 126.5 -1 -1 {0×0 char} 1750 3 1750.2 148.7 -1 -1 {0×0 char} 1750 4 1750.3 147.2 -1 -1 {0×0 char}
plot(data.Var1(256:345),data.Var2(256:345))
Change the names of the variables as appropriate please.
  댓글 수: 1
HAMBA IVAN
HAMBA IVAN 2022년 11월 9일
Thank you so much. This has really helped me a lot

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

카테고리

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