Plotting specific values of 2xn array based on values in first row
Mostrar comentarios más antiguos
Hello! I have 2xn arrays. The first row contains values between 1 and 6 that code specific events that happened at the timepoints that are saved in the second row. Something like this:
1 4 5 1 5
200 350 360 400 600
Goes on like that. It's probably really basic. I want to plot only the timepoints in the second row for the specified event codes in the first row. I hope this is clear. Thanks!
Respuesta aceptada
Más respuestas (1)
Rose
el 22 de Sept. de 2015
0 votos
I think you mean like this:
>> x=[1 4 5 1 5;200 350 360 400 600];
>> plot(x(1,:),x(2,:))
You even can add more details to the plot or set the axis limits:
>> plot(x(2,:),x(1,:),'*','LineWidth',1);
>> axis([100 700 0 6]);
xlabel('Time')
ylabel('Values')
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!