Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Making a graph from my Matrix

2 visualizaciones (últimos 30 días)
Jay Stewart
Jay Stewart el 6 de Sept. de 2018
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
I have a matrix of 29 x 5 that I am trying to plot a graph with. The first 4 columns are the data points while the last column is a classifier of 1 and 0 to separate the data into Group A and Group B. The graph needs to have the first 4 columns to act as the y axis, while the x-axis is time points 1,4,7, and 10. Each row needs to have its own line connecting the data points and the color of the lines needs to be either red for group A or blue for Group B. How would I make this?
  1 comentario
madhan ravi
madhan ravi el 6 de Sept. de 2018
Can you upload the matrix?

Respuestas (1)

jonas
jonas el 6 de Sept. de 2018
Editada: jonas el 6 de Sept. de 2018
A is your matrix
x=[1 4 7 10];
plot(x,A(A(:,5)==1,1:4),'r')
plot(x,A(A(:,5)==0,1:4),'b')
  2 comentarios
jonas
jonas el 6 de Sept. de 2018
Editada: jonas el 6 de Sept. de 2018
That's odd. I'm not having any trouble with it. Try running my attached m-file.
jonas
jonas el 7 de Sept. de 2018
Any success?

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by