필터 지우기
필터 지우기

Help with an Assignment.

조회 수: 4 (최근 30일)
John Marshall
John Marshall 2015년 10월 11일
댓글: Walter Roberson 2015년 10월 11일
Down below is the code I have been working it is to display true or false through a series of if/else statements to determine the correct output. I am relatively new to matlab and any help in determining the reason that the output is not being display would be great. Thank you very much.
Var_1 = input('Enter age');
Var_2 = input('Enter Gender');
Var_3 = input('Enter chest pain type');
Var_4 = input('Enter resting blood pressure');
Var_5 = input('Enter Serum cholestoral');
Var_6 = input('Enter Fasting blood sugar');
Var_7 = input('Enter resttin ECG results');
Var_10 = input('Enter ST depression induced by exercise relative to rest');
Var_12 = input('Enter number of major vessels');
Var_13 = input('Enter heart condition');
if Var_3 <=3 && Var_10 <= 1.9 && Var_1 <=56
disp('False')
elseif Var_1 > 56 && Var_2 <= 0 && Var_1 <= 59
disp('True')
if Var_3 <= 3 && Var_10 <= 10 && Var_1 > 56 && Var_2 <= 0 && Var_1 > 59;
disp('False')
elseif Var_2 > 0 && Var_5 > 245
disp('True')
if Var_3 <= 3 && Var_10<=1.9 && Var_1 > 56 && Var_2 > 0 && Var_5 <= 245 && Var_6 <= 0 && Var_12 <= 0
disp('False')
elseif Var_12 > 0
disp('True')
if Var_3 <= 3 && Var_10 <= 1.9 && Var_1 > 56 && Var_2 > 0 && Var_5 <= 256 && Var_6 > 0
disp('False')
elseif Var_10 > 1.9 && Var_7 <= 1
disp('True')
if Var_3 <= 3 && Var_10 > 1.9 && Var_7 > 1 && Var_1 > 59
disp('True')
elseif Var_1 <= 59
disp('False')
if Var_3 > 3 && Var_13 > 3
disp('True')
elseif Var_13 <= 3 && Var_12 > 0 && Var_2 > 0
disp('True')
if Var_3 > 3 && Var_13 <= 3 && Var_12 > 0 && Var_2 <= 0 && Var_11 > 1
disp('True')
elseif Var_11 <= 1
disp('False')
if Var_3 > 3 && Var_13 <= 3 && Var_12 <= 0 && Var_4 > 145
disp('True')
elseif Var_4 <= 145
disp('False')
end
end
end
end
end
end
end
end
  댓글 수: 4
Image Analyst
Image Analyst 2015년 10월 11일
Have you tried stepping through the code with the debugger and examining why you're not going into the "if" block?
Walter Roberson
Walter Roberson 2015년 10월 11일
We readers do not know what the various codes are. For example we do not know which of the more than 83 genders code as 1, which one as 2, which one as 3, and so on. Give us a specific set of inputs.
For example it is obvious that your code will fail if you enter multiple values for some of the inputs, so we need to know exactly what you are entering.

댓글을 달려면 로그인하십시오.

답변 (1개)

Eng. Fredius Magige
Eng. Fredius Magige 2015년 10월 11일
Hi Its work just enter at least one data

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by