Operands to the || and && operators must be convertible to logical scalar values.
조회 수: 5(최근 30일)
So I don't understand the reason why I am getting the following error:
if (data.A>5) || (data.B==1)
data is a table
A is of type double
B is of type logical (0s and 1s)
I am still getting used to this table logic and cell content type of data.
Mitch Lautigar 2022년 5월 5일
%MATLAB is expecting a 1 or 0 for preexisting conditions. IF the values in the table are true/false, use strcmpi(). This would look like (strcmpi(data.Preexisting_Conditions,"true"))
if (data.Age>60) || (data.Preexisting_Conditions==1)
riskUserId= [riskUserId;data.User_ID]; %Stack all values into an array for easy viewing.