0

Operands to the || and && operators must be convertible to logical scalar values.

the code is to evaluate the editfield if they are empty, there an equation is inserted in each one; what I am trying to do is that if the fields of the editfield are empty, the error will appear, but if not, the code will be executed; the error I mention in the title

        cla;
        syms x y ;
        Eqn1=str2sym(app.Ecu1.Value);
        Eqn2=str2sym(app.Ecu2.Value);
        if (isnan(Eqn1) || isnan(Eqn2))
            errordlg('File not found','File Error');
        else
            %ejecute code
        end
Andre3600
  • 17
  • 5
  • Maybe do `if isempty(app.Ecu1.Value) || isempty(app.Ecu2.Value)` – Cris Luengo Mar 22 '20 at 02:39
  • I guess, that this should work even if `Eqn1` and `Eqn2` are (non-evaluated) symbolic functions. `isnan` checks only for `NaN`s, not if there is a reasonable result. Please post a working example to reproduce your error (BTW, what does the tag *matlab-app-designer* has to do with this question? – max Mar 22 '20 at 07:27
  • thanks for the help it helped me, I saw an example that something like this had been done with isnan, I put the label application designer because I thought I had to have some change but I already realized how it is, thanks – Andre3600 Mar 22 '20 at 21:07

0 Answers0