# Divide data in parts and plot them on a vertical line

1 view (last 30 days)
Jialin HE on 24 Feb 2022
Commented: Jialin HE on 24 Feb 2022
Hello!
I have a matrix that stores my probability, number of data analyzed and time (time and #samples are related, every single data is sampled at 0.033 seconds, so 3.3 for 100); it looks like:
0.873615503511876 100 3.30000000000000
0.902974727374816 100 3.30000000000000
0.900676294700403 100 3.30000000000000
0.936103354207504 200 6.60000000000000
0.897578193607001 200 6.60000000000000
0.944744655111605 200 6.60000000000000
0.972746082496182 300 9.90000000000000
0.940582356717829 300 9.90000000000000
0.977908283040241 300 9.90000000000000
0.962956328635856 400 13.2000000000000
0.968370651998859 400 13.2000000000000
0.980665507251175 400 13.2000000000000
I want to have a 2D plot with probability values on y axis and time on x axis, where all datas recorded at the same time are allineated vertically. In this way I should get a plot at the end where on x I have 3.3, 6.6, 9.9, 13.2 and for every one of these 3 point on y axis.
Can someone help me do that? Thanks!

Scott MacKenzie on 24 Feb 2022
From your description, this seems to work:
M = [
0.873615503511876 100 3.3;
0.902974727374816 100 3.3;
0.900676294700403 100 3.3;
0.936103354207504 200 6.6;
0.897578193607001 200 6.6;
0.944744655111605 200 6.6;
0.972746082496182 300 9.9;
0.940582356717829 300 9.9;
0.977908283040241 300 9.9;
0.962956328635856 400 13.2;
0.968370651998859 400 13.2;
0.980665507251175 400 13.2];
scatter(M(:,3), M(:,1), 'filled');
xlabel('Time');
ylabel('Probability');
Jialin HE on 24 Feb 2022
I figured that out after and I did the same, thank you anyway!

### Categories

Find more on Matrix Indexing in Help Center and File Exchange

R2021b

### Community Treasure Hunt

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

Start Hunting!