How to plot time-space diagram?

조회 수: 11 (최근 30일)
Matlab Newbee
Matlab Newbee 2017년 12월 25일
댓글: Matlab Newbee 2017년 12월 26일
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

채택된 답변

Birdman
Birdman 2017년 12월 25일
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
Birdman
Birdman 2017년 12월 26일
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 2017년 12월 26일
Thank you. That is exactly what I wanted

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by