MATLAB: How to change a sound in a specific condition

changeconditionsound

while 1
brain=fread(bt)
if (100<brain) && ( brain<150)
disp ( 'attention')
elseif .....condition goes here
disp('meditation')
end
end

Best Answer

conditions_list = {'?', 'attention', 'meditation'};
while 1
brain=fread(bt);
if isempty(brain); break; end
mask1 = (100<brain) & ( brain<150);
mask2 = second_test_goes_here
condition = ones(size(brain));
condition(mask1) = 2;
condition(mask2) = 3;
brain_conditions = conditions_list(condition);
disp( strjoin(brain_conditions, ' '));
end
Related Question