How can I overcome the error "variable admit must be of data type logical instead of double"..I have to return logical values true or false using the function below.what is wrong with this?
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
vidushi Chaudhary
am 15 Mai 2020
Bearbeitet: DGM
am 3 Mär. 2023
function admit=eligible(v,q)
avg=(v+q)/2;
if avg>=92 ...%%
&& v>88 ... %%
&& q>88 %%
admit=1;
else
admit=0;
end
1 Kommentar
Akzeptierte Antwort
Fangjun Jiang
am 15 Mai 2020
The error message must have come from somewhere else, not from this function. Here, nothing is wrong except that the data type of "admit" seems not to comply with the required "logical" data type required by somewhere else.
You can use admit=ture, admit=false. "true" and "false" are defined in MATLAB.
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Performance and Memory finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!