how to plot like in other CAS
Info
This question is closed. Reopen it to edit or answer.
Show older comments
hi y is a vector whose vlaues can be any value (whole numbers) from range form 0 999999 . total values in y are few thousands. i want to plot those values where x axis should be from 0 999999 and if a vlaue a y value of 1 for each occurance..
so if y=[33333 44432 33333 111111]
the graph x-axis should be from 0 - 999999 and at x=33333 y value should be 1+1 (two occurances) and at 44432 y value should be 1.,
i made x=1:999999; but when i stem y against x lenghts do not match.
how can i zero fil all values that are not present in y . and set y value an increment of 1 for each occurance.
Answers (2)
Walter Roberson
on 24 May 2016
uy = unique(y);
counts = histc(y, uy);
bar(uy, counts)
Chamjiee Tramadol
on 27 May 2016
Edited: Walter Roberson
on 28 May 2016
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!