Is it posible to set up a function in matlab that returns an interval of numbers into a specified letter, i can only make 1=A, 2=B and so on... I want a function that can make numbers between 0-10.5=B, 9.5-20.5=X, all the way up till 300 with a new letter each time, is that even possible or do i just have to make the long manual way?
I would write a function as:
function out = mapNumbers(num)
buckets = [10.5:10:300]; % Create array of the form 10.5 20.5 30.5 ....290.5
letters = [B X ....]; % You will have to type all letters, there is no way out
idx = find(buckets > num, 1); % find 1st bucket edge > num
out = letters[idx]; % This is the letter the number corresponds to
end
You can tweak with the buckets and find to make it work for your case. Make sure that buckets > num
really works the way you define your number to be in a particular bucket (> and >= stuff).