Keep getting error message "Index exceeds array bounds."
Mostrar comentarios más antiguos
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
2 comentarios
madhan ravi
el 8 de Oct. de 2018
Which line shows error?
Ethan Hawley
el 8 de Oct. de 2018
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!