Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Plotting two random vector

1 vue (au cours des 30 derniers jours)
eric chung
eric chung le 30 Mai 2020
Clôturé : MATLAB Answer Bot le 20 Août 2021
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!

Réponses (1)

Ameer Hamza
Ameer Hamza le 30 Mai 2020
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