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
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 2-D and 3-D Plots 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!