group data into categories which display the category name
3 views (last 30 days)
Show older comments
I have a 26,000 long dataset of degrees (angle 0-360).
I want these categories 0-90 = A 90-180 = B 180-270 = C 270-360 = D
(A, B, C, D are strings).
what loop do I need to run through the data set and display the four letter for each category. I.e. to form the dataset:
A C D B B B A D C D D D C C A B D C D A .............. etc
0 Comments
Answers (1)
Azzi Abdelmalek
on 2 Jul 2013
Edited: Azzi Abdelmalek
on 2 Jul 2013
data=[25 90 95 185 275 360];
s='ABCD',
idx=ceil(data/90)
idx(idx==0)=1;
out=s(idx)
0 Comments
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!