Effacer les filtres
Effacer les filtres

How can I plot and label 4 lines from 1 vector?

4 vues (au cours des 30 derniers jours)
schilakwad
schilakwad le 3 Nov 2020
Réponse apportée : KSSV le 3 Nov 2020
I have a function that creates 1 long vector from a row in a table (124 columns) and then plots that vector. I'd like to divide that vector into 4 parts and plot each part as a line on the same graph with its own lable e.g. Vector - Part 1, Vector - Part 2 etc. The X axis is the same for all the parts.
  1 commentaire
Rik
Rik le 3 Nov 2020
What have you tried? Can you post example data?

Connectez-vous pour commenter.

Réponse acceptée

KSSV
KSSV le 3 Nov 2020
Read about reshape, plot and legend.
A = rand(1,124) ;
B = reshape(A,[],4) ; % reshape into 4 columns
plot(B)
legend("Part1","part2","part3","part4")

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by