The same script works perfectly on Matlab and does not on app designer
17 views (last 30 days)
Show older comments
ErikJon Pérez Mardaras on 25 Feb 2021
Commented: ErikJon Pérez Mardaras on 26 Feb 2021
I have made a code which the user enters as inputs several variables and when running the code, it (the code) calls several scripts to calculate the oututs. If I execute it on command window or even in the script itself, it works perfectly.
The point is that I am implementing it on matlab app designer. In an app that when you click the button, the code calls the scripts and the program gives the outputs to the user. So, here, when the code calls one of the scripts called "jENG000_ca1", matlab gives me the following error on the jENG000_ca1 script's line 53.
Here is exactly the code in that line:
if (epsilon==6969)&&(m~=6969)&&(alfa~=6969)&&(R1~=6969)&&(R2~=6969)&&(Rb1~=6969)&&(Rb2~=6969)&&(Rc1~=6969)&&(Rc2~=6969) %line 53
[epsilon,R1,R2,Rc1,Rc2,ro1,ro2,alfa,m]=epsilon00(epsilon,R1,R2,Rc1,Rc2,ro1,ro2,alfa,m) %line 54
end %line 55
I have tried also with the parenthesis (as you can see in the image) and without them and it works perfectly on matlab and on the script, but as you can see, does not work in matlab app designer.
How can I solve this? As long as I know, I am not doing anything wrong.
Thanks a lot
Steven Lord on 25 Feb 2021
My guess is that when you call the function in the Command Window or script you're calling it on scalar data but when you call it in App Designer you're calling it with non-scalar data.
This could happen if one or more of the variables epsilon, m, alfa, R1, R2, Rb1, Rb2, Rc1, or Rc2 are being read from an edit box in the app and are being read not as numeric data but as text.
A1 = '12345';
A2 = 12345;
A1 == A2 % None of the characters '1', '2', '3', '4', or '5' are equal to 12345
whos A1 A2
If that's the case, convert the text data to numbers.
A3 = str2double(A1);
A2 == A3
whos A1 A2 A3
More Answers (0)
Find more on Whos in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!