how can I plot particular rows of a matrix?
Afficher commentaires plus anciens
I have a 7208x34 matrix which columns [3 32] represent price data over the 1961-1990 period. And a row array 1x30 (the row array indicates the years from 1961 to 1990). I want to plot time series of 68 rows (i.e. grouping by cities) for each goods over the 1961-1990 period, against the 1x30 row array (years). Something looks like this:
Goods city_name price_year1961 price_year1962…
A city1 0.5
A city2 0.7
.
.
.
A city68 0.9
B city1 0.4
B city2 0.7
.
.
.
B city68 0.9
and a row vector represents the years [1961:1990].
Thank you very much!
Réponse acceptée
Plus de réponses (2)
KSSV
le 10 Juil 2019
If A is your data...and you want to plot ith row; use
plot(A(i,:))
1 commentaire
ogheneochuko oyaide
le 25 Août 2022
bro. you are good. thanks
Tran Trang
le 10 Juil 2019
Modifié(e) : Tran Trang
le 10 Juil 2019
0 votes
2 commentaires
Basil C.
le 11 Juil 2019
Yes you are correct, it should be
city_data = prices(n:68:end,:)
In order to plot all the goods but with each plot for each good at once you could try the subplot function
Tran Trang
le 11 Juil 2019
Catégories
En savoir plus sur 2-D and 3-D Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!