group data into categories which display the category name

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

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 7월 2일
편집: Azzi Abdelmalek 2013년 7월 2일
data=[25 90 95 185 275 360];
s='ABCD',
idx=ceil(data/90)
idx(idx==0)=1;
out=s(idx)

카테고리

도움말 센터File Exchange에서 MATLAB Coder에 대해 자세히 알아보기

질문:

2013년 7월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by