How to plot time-space diagram?

i have an excel file with the following type of data. Columns represent ID,time and x cordinate respectively.
Is there any way that I could plot a graph against x-cordinate and time for different IDs? I have 1000's of Id's and this is just a preview for first two ID's.
theoretically these are locations of vehicles at different times. so therefore i need to plot graphs for each vehicle in the same graph.
Thanks

 Respuesta aceptada

Birdman
Birdman el 25 de Dic. de 2017
Use hold on command. Consider these vectors are stored in a multidimensional array called data.
plot(data(:,1),data(:,2));hold on;grid on;plot(data(:,1);data(:,3))

3 comentarios

Matlab Newbee
Matlab Newbee el 26 de Dic. de 2017
Thank you for the suggestion. i tried hold on and it is useful when you have a straight forward array.
In this case, to clarify my problem, I need to filter the rows with ID '1' and plot a graph for that, and then ID '2', so on...
Is there any way that I could do that?
Thank you
Birdman
Birdman el 26 de Dic. de 2017
Yes there is. For instance, consider the following for your description in the problem.
A(A(:,1)==1,:)
The above line will give you rows with ID=1, then do the same for ID '2'. and then using plot command, you can plot whatever you want.
Matlab Newbee
Matlab Newbee el 26 de Dic. de 2017
Thank you. That is exactly what I wanted

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 25 de Dic. de 2017

Comentada:

el 26 de Dic. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by