Keep getting error message "Index exceeds array bounds."

I've looked over my code, and my teacher has looked over my code, but nobody cam figure out what's wrong. Here's my code:
% USER INPUT STATEMENTS
gender = menu('What is your gender?', 'Male', 'Female');
age = input('What is your age?');
weight = input('What is your weight in pounds?');
% This sections finds out essential information to compute the heart rate
% SENSOR INPUT STATEMENTS
hrate = dec2bin(88)
str = string(hrate);
% This section converts the sensor readig of the heart rate to a string
% DETERMINE AND DISPLAY CURRENT HEART RATE
chr = bin2dec(hrate);
disp(chr);
% This section displays the current heart rate in decimal
% COMPUTE MAXIMUM HEART RATE
if gender==1
MHR = (205.8-0.685*(age));
else
MHR = (206-0.88*(age));
end
% This section computes the maximum heart rate.
% CONDITIONAL STATEMENTS AND OUTPUT DISPLAY STATEMENTS
if chr < .6*MHR
disp('Below Level');
elseif .6*MHR <= chr < .7*MHR
disp('Weight Loss');
elseif .7*MHR <= chr < .8*MHR
disp('Cardio');
elseif .8*MHR <= chr < .9*MHR
disp(Anaerobic (Hardcore));
else
f= msgbox('lmao what you doin still alive you should be dead', 'lmao m8');
end

 채택된 답변

madhan ravi
madhan ravi 2018년 10월 8일
>> COMMUNITY
What is your age?50
What is your weight in pounds?100
hrate =
'1011000'
88
Below Level
>>

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

태그

질문:

2018년 10월 8일

댓글:

2018년 10월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by