フィルターのクリア

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 Center および File ExchangeDevelop 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