I want to plot selected data from rows and columns

37 views (last 30 days)
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

Answers (3)

Torsten
Torsten on 9 Nov 2022
Edited: Torsten on 9 Nov 2022
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 on 9 Nov 2022
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 on 9 Nov 2022
Edited: Hiro Yoshino on 9 Nov 2022
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.

Community Treasure Hunt

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

Start Hunting!