LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scilab Script in Labview

I am trying to invoke a Scilab (v4.1.2) script in an empty Labview (v8.5.1) VI, and am continually receiving an error simply telling me that an error occurred while running the script. The script works in scilab alone. I've commented out the 'd' input in the script to try and have labview control it just as my first attempt at an interface between these two programs.

Can anyone see where I am going wrong, or possibly how I could figure errors like this out on my own? It just doesn't point me in any direction to find the error, so I'm stuck.

Thanks
0 Kudos
Message 1 of 9
(5,312 Views)
More specifically:

Error 1050 occurred at LabVIEW:  Error occurred while executing script. Error message from server: . in Interpolation.vi

LabVIEW:  Error occurred while executing script.

Some strange things happen, like I run it and get the error. Then if I comment out the file call, it runs and any changes I made will run just fine.
0 Kudos
Message 2 of 9
(5,267 Views)
Hello,

I see some problems when running the script as well.  It seems there are some slight problems communicating with the Scilab software.

First, when looking at the text in the Scilab script node, I see an extra character before the new line.  Upon closer investigation, the script contains both a carriage return and a line feed at the end of every line.  This currently causes a problem with the Scilab software.  I was able to eliminate the extra character (the CR) by loading the script from disk in a text editor and copying and pasting it into the script node.

Second, getcwd may not return what you expect.  It is not the directory in which the VI resides (unless you happened to put the VI in Scilab's default working directory).  You can find out what it returns by simply calling that function and then creating a string output variable on the script node.  Another method to specify the location of your data file is to pass in a string that is the current VI's location on disk.  You can find this using the Programming >> File I/O >> File Constants >> Current VI's Path primitive.  Simply use the Strip Path primitive to get the directory name.  Wire that into the script node as a string input and then append the filename like you currently do.

Third, comments in the script seem to cause some problems.  The script node doesn't actually return an error, but most of the script simply doesn't execute.  Try removing all your comments from the script.

Last, the Scilab-LabVIEW Gateway currently does not support plotting from the Scilab software, so your plot commands will not work.

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
Message 3 of 9
(5,261 Views)
Hi jaysmall,

I believe the problem may lie with your fd variable.  The getcwd() command may be returning a different directory than the one you are running the VI from, so your script may be trying to open the file in the wrong place.  Try it with the absolute path of the file, that seemed to clear the error when I tried it.
Regards,

Jeremy_B

Applications Engineer
National Instruments
0 Kudos
Message 4 of 9
(5,260 Views)
Yeah, I found one of the problems. Any comments (//comment here) cause the rest of the script to be commented out.

So when I commented out the call to the file, it also commented out all the rest of the code, as /* does in C, which caused it to look like it ran properly.

I also noticed that you may not call any function which is seen in a Scilab window (user input, graphs, etc.), this caused the script to throw the errors seen.

I don't know if this is the right place to suggest it, but those could be some serious improvements to the LabVIEW-Scilab Gateway. Especially the comment issue since it means I can't keep a long script around for a while, as I'll forget what it does.

Thank you for your help.
0 Kudos
Message 5 of 9
(5,245 Views)
Hi jaysmall,
 
We have a Corrective Action Request on file for the comments problem, it is CAR# 97917.
Regards,

Jeremy_B

Applications Engineer
National Instruments
0 Kudos
Message 6 of 9
(5,242 Views)
Good to know, thank you
0 Kudos
Message 7 of 9
(5,240 Views)
Aparently the underlying issue on this has not been resolved. There will be some times when I open the file, and it will run flawlessly. But at the same time, I could close the VI, immediately reopen it with no changes, and it suddently will tell me

"LabVIEW: Error occurred while executing script."

Is there a reported issue on this? It doesn't even tell me what the error is so I have no idea how to go about debugging it.
0 Kudos
Message 8 of 9
(5,214 Views)
Hi jaysmall,

Can you post your latest VI?  I want to see if I can reproduce it here, and then I may be able to file a new CAR on it.
Regards,

Jeremy_B

Applications Engineer
National Instruments
0 Kudos
Message 9 of 9
(5,204 Views)