I am using LabView + Matlab to control a system, the issue is that everytime I try to do an else if statement, I get an error from the software.
"LabVIEW: LabVIEW failed to send variable to the script server."
If I use just If + else, it runs ok, but when I try to do if + if else + else, the error comes back. Someone have the solution? May I am comitting some type of error?
I cannot comment on this particular error you get, but I give two advices:
Here is some more reading: http://www.ni.com/newsletter/51735/en/
I appreciate your advices.
But the doubt is just about the if statements, I don't see why other parts of the code matters here.
When I am using if + else, it works, when using if + if else + else, it fails.
Other parts of the code does not affect this matlab script, right. But in overall, your programming style is dangerous, almost impossible to debug such code. I see many strange things and lots of Rube Goldberg constructs. Besides, why do you need that MATLAB script, that simple logic can be easily programmed using LabVIEW functions...?
The code is this way because my Teacher of Nonlinear Control give us this task to be made in 1 week and I don't have time to do it the right way 😄
The Matlab script is just because he demands that the control algorithm must be made in Matlab.
Yeah, this is nonsense, but I have to do it.
Right now i do not have access to LabVIEW to test this script. Could you put together a very simple vi, where you can reproduce this error? Just a simple vi only with this matlab script. Also double check whether you are using the correct syntax in the script. If you can recreate this error, attach this simple vi, so people can test it and figure out what is wrong.
Thanks to everybody.
I am working in this code for hours and I had perceived that everytime I use a float in the code, the error returns.
For example, I have an expression:
if I change 27 per 27.5, I got the same error. I have no idea why, but I adapted the code to bypass this problems in another way.