Plotting data within a loop
Afficher commentaires plus anciens
Plotting data within a loop
I have a data in four columns
x, y, t, and ID
In this formar
1st column: X1,X2,X3,X4, X5, X6, X7, X8, X9…..Xn.
2nd column: Y1,Y2,Y3, Y4, Y5, Y7, Y8, Y9…..Yn
3rd is Time: 1,2,3,1,2,1,2,3,4,1,1…..n
4th ID: 1,1,1,2,2,3,3,3,3,4,5….
So whenever ID change the time start value. I want to plot each ID separately. For example: 1 track should be for ID=1, 2ndtrack for ID=2 and so on.
This is my code:
Tr is data file.
max1=max(tr(:,h)); %h column is ID column
for s=1:max1
for r=1:g
if tr(r,h)==s
scatter(tr(r,1),tr(r,2),5, 'filled','LineWidth',0.5)
hold on
end
end
end
This code has 2 problem. First too slow. 2nd I get scatter plot and each point is different color. I can not get tracks for each ID.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Title 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!