Info

此问题已关闭。 请重新打开它进行编辑或回答。

Plotting two random vector

1 次查看(过去 30 天)
eric chung
eric chung 2020-5-30
关闭: MATLAB Answer Bot 2021-8-20
This is a very simple question but im having a hard time figuring it out.
Im trying to make a line graph from two vectors.
The first set of data is the x axis points of [1:16] representing week 1 to week 16.
The second set of data is the y axis points of a section of a large data table; the data table goes to 900 rows with 3 columns and i just need the values of rows 816 to 832 in the first column.
I tried various different methods but they all had errors of different kinds.
For such a simple task i find it hard to figure it out. Any help is appreciated thanks!

回答(1 个)

Ameer Hamza
Ameer Hamza 2020-5-30
816 to 832 makes up 17 elements. So I guess the range should be 817 to 832. If the data is available in Table datatype, then you can access it using brace indexing. For example
x = 1:16;
y = T{817:832,1}; % T is name of table
plot(x, y)

Community Treasure Hunt

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

Start Hunting!

Translated by