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
Attachments:
Scilab_labview.zip ‏7 KB

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

Similar Messages

  • Problem creating inputs, outputs and text in Scilab Script Block

    I have recently installed the Labview to Scilab Gateway.  I am running Labview 11.0 and Scilab 5.3.3.  The example files run properly, However, when I try to define any inputs, or outputs, there is no option to add the ports.  The block also ignores any text I type in it or copy to it.  I have been trying this on a blank vi.
    Solved!
    Go to Solution.

    Hi Ronny,
    I have a few more questions to help us debug this issue.  You said you tried the same right-click procedure to create inputs and outputs on a normal script block and it worked as expected.  What specifically do you mean by a "normal script block"?
    How did you drop the empty Scilab script node on a blank VI?  Did you drop it from a palette or paste it from another VI?
    Can you post an image of your Help >> About LabVIEW screen (feel free to obscure your name, company, and license number)?  If not, can you provide the LabVIEW version number specified from that screen?  There have been a few patches to LabVIEW 2011 and it will help us to reproduce the issue if we know exactly which version you have.  Also on that screen, do you have LabVIEW Base, Full, or Professional (or maybe an Evaluation or Student edition)?  The Scilab script node will not work in LabVIEW Base and the right-click menu will look as you describe.  You can verify your LabVIEW activation in the NI License Manager.
    Do you have any other versions of LabVIEW installed on your computer?  Is LabVIEW 2011 the most recent LabVIEW you installed?  How about previous versions of Scilab?  Do any previous versions remain or did you remove a previous version of Scilab AFTER installing Scilab 5.3.3?
    Grant M.
    Senior Software Engineer | LabVIEW Tablets | National Instruments

  • Same code gives different results in Matlab Script in Labview and Matlab

    I am implemeting a Matlab code into a LabVIEW application using Matlab script. When I import the exactly same code to the Matlab Script in LabVIEW it gives a different result than it is in Matlab. This code is a simulation code including first kind bessel functions. Using LabVIEW 7.1 and Matlab R14 service pack 3.

    Labview 8.5
    Matlab R2009b
    Attached are the graphs produced by matlab script in labview and in matlab.
    The minimum of graph produced by matlab code is below 1 and that in labview is above 1.
    Thanks a lot for your reply.
    Sorry, I haven't quantified the "sometimes" yet. 
    Attachments:
    matlabsResult.jpg ‏29 KB
    LV.png ‏84 KB

  • Calling a vi in scilab script

    Hello!
    What I'm trying to do here is the following: I am developping a VI that uses a certain algorithm to function. I put the algorithm into a Scilab script structure, no problem here I already did that.
    The problem is, during the execution of the script at many points I need to get additional data through a sub-VI. I want to avoid a structure that looks like Script=>sub-VI=>Script=>subVI=>etc...so my question is: how can I call a sub-VI from inside the Scilab script?
    Thank you very much!

    Hello, thanks for the quick answer.
    I do not have a screen capture at hand, besides my VI a a bit too messy at the moment, but hopefully it can be explained quite clearly.
    Basically, I am implementing a Nelder-Meads simplex method, where the input of the script is the coordinates of 3 points, and from it the coordinates of one or two other points are calculated. Problem is, from here the algorithm needs to go measure those new points physically, using another sub-VI. After which I need to input those measurements into another script so I can compare all the points and choose which ones are better.
    Actually I decided to code it like I described, alternating scripts and sub-VIs (I kinda had a schedule to follow ), but I thought it would still be interesting to know if it is actually possible to do it with one big script.
    During my search I found some interesting leads using matlab, namely using ActiveX (there) but I couldn't find corresponding commands in Scilab.
    Any ideas about that? or any other ways to do it?
    thanks!

  • Scripting in LabVIEW

    Hi, could you please let me know what is the easiest scripting method that can be used in LabVIEW, we have engineers that know nothing about LabVIEW, they want an scripting language to do simple things like assignments , for loop, while loop and basic math functions such Mean . Is math script ( Matlab) the best choice?
    The problem I have with Math Script is , I think it is good for complicated mathematics but it can't be used as a command script for LabVIEW ?
    For example if I have this line in that scripting window
    vpp= 10
    then I would like to pass that value to a VI, if I don't have this line then there is no need to have that VI
    Is there any LabVIEW scripting language that can be good for this purpose?

    Thanks jcarmody and Yamaeda for your suggestions
    Before working on your idea about using Paython I would like to show you one example and if you think the toolbox can handle that I will continue
    This is one of the m files ( matlab ) provided by them:
    As you can see below they can call functions , use basic math functions and use basic commands such as if , for , while?
    They would like to have an environment like this but when for example they call a function I don't want to run a Matlab or Paython code. I want to run a SubVI which is specified for that command and then we goto to the second line and continue. SO everything should be implemented in LabVIEW but I want to give them this capability to write scripts (since they don't know LabVIEW) but everything should be execute in LabVIEW. Can the Paython toolbox give me this capability?
    If not do you have any suggestion
    vTest = 0.8; %default voltage value for current measurements is 0.8V
    end
    atpMode = 2;
    atpAddress = 3;
    tpCfg = 'ATP';
    tpAnaBuff = 'OFF';
    configATP(dutNum,ATPmode,ATPaddress,tpCfg,tpAnaBuff);
    %This function sets up the DUT test mode and test point
    vdd = [];
    vpp = [];
    configTIBVolt(vdd,vpp,vTest);
    % This funciton configures the analog voltages on the test interface board
    % Variables that are empty would retain their previous values
    bufferOn = 0;
    configDUTRelay(bufferOn);
    % This function configures the relay that selects the analog buffer on the
    % DUT board. For current measurements, the buffer should be bypassed
    k = 1;
    trimCode = 0;
    while(trimCode(k) < 8 && trimCode(k) > -9) %iBias Trim is 2's complement 4-bit
    numBits = 4;
    trimCode_twosComp = dec2twosComp(trimCode(k),numBits);
    % this function converts the decimal trimCode into its 4-bit two's
    % complement form since the iBias trim codes are in two's complement
    regData = ['xxxx',trimCode_twosComp];
    regAddr = 13;
    regReadModifyWrite(dutNum,regAddr,regData)
    % This function reads the register value, modifies only the selected bits,
    % (i.e. those that aren't 'x'), then writes back to that register.
    % This is to avoid overwriting unrelated bits in the same byte
    dutOut = 'CURR_MEAS';
    pxiAnaIn = 'CURR_MEAS';
    dutVpp = [];
    dutVdd = [];
    configTIBMux(dutNum, dutVpp, dutVdd, dutOut, pxiAnaIn);
    % This function configures the test interface board analog switches for
    % VDD, VPP, DUTout, and PXIanaIn
    % Variables that are empty would retain their previous values
    pauseTime = 1e-3;
    pause(pauseTime);
    % Wait for everything to settle.
    if( k>2 && direction(k)~=direction(k-1) )
    % If the sign of the error changed, then the best trim code is
    % either this one or the one just before it
    [Y, minIndx] = min(abs(iBias-targetIBias));
    % Finds the index with the min error
    iBiasTrimCode = trimCode(minIndx);
    iBiasMeas = iBias(minIndx);
    % assigns values to output variables
    trimCode_twosComp = dec2twosComp(iBiasTrimCode,numBits);
    regData = ['xxxx',trimCode_twosComp];
    regReadModifyWrite(dutNum,regAddr,regData)
    % write the best trim code t0 the DUT
    return
    % Exit the function
    end
    trimCode(k+1) = trimCode(k) + direction;
    k=k+1;
    end
    % If we've reached this portion of the code, then we failed to find an optimal
    % trim code. We should just return the last values, since these are as close
    % as we can get to the target (i.e. we're at the edge of the range)
    iBiasTrimCode = trimCode(end-1);
    iBiasMeas = iBias(end);

  • Command line script in LabView 2010 Win7

    Hi guys,
    How to execute a CL script in LabView 2010 and pass parameters to it?

    Hi JoVMo,
    you'll find it in the connectivity section. If you need some other functions and you don't know where it is, then you can search it. Click on the search button in the function palette from the blockdiagram.
    Hope it helps.
    Mike

  • Using Matlab script in Labview

    Hello,
    I am trying to use matlab script in labview to post process the sampled signals from DAQ(attached is the vi I tried)
    After every 10 seconds I want to the send the sampled voltage data to matlab scritp block which does 1) detection of peaks using peakdetection function and plots the obtained peaks on the sampled signal 2) calculates standard of 10 secs data and plots on chart.
    But I am confused of 1) how to call the peakdetection function inside the matlabscript block
    2) How to send the 10secs data of voltage and time values to the matlab script block
    3) How to plot the signal and detected peaks on the same plot (which can be done in matlab using holdon as shown in the atached vi).
    Can someone suggest for implementing these .
    Thanks.
    Solved!
    Go to Solution.
    Attachments:
    Labview&Matlab.vi ‏55 KB

    Thanks  GabeG,
    Now, Labview&Matlab_TestNoAq.vi  is woking Good and for the second one  Labview&Matlab_TestAq.vi it is showing error as shown in the attached image when these ines of code are present in the matlab scrtip 
    subplot(2,1,1),plot(maxtab(:,1),maxtab(:,2),'*r');
    SDN=std(maxtab(:,1));
    and SDN output of the Matlab script
    but when I removed these it is working fine(but not showing the detected peaks).
    Can you suggest me a solution for the above and also can I know the best method to add one more channel that samples another device signal which has to be processed in this same way(Signals sampled from 2 devices have to be porcessed in this same way).
    Thanks.
    Attachments:
    Script_Error.JPG ‏133 KB

  • Matlab script in Labview

    Hi there,
    I want to integrate my Matlab script in Labview,
    the input variable should be a Matrix like
    the following A = [ 0 256 ; 1 256 ;1.5 100 ; 1.55 110; 1.59 55; 1.6 56 ; 9 256; 14 256 ;15 100 ]
    How do I do this in Labview, I tried an array but
    no succes...
    Bye for now

    hi chris .. thanks for the reply ...
    here's the results from 'ver
    MATLAB Version 7.0.1.24704 (R14) Service Pack 1
    MATLAB License Number: 227039
    Operating System: Microsoft Windows XP Version 5.1 (Build 2600: Service Pack 2)
    Java VM Version: Java 1.4.2_04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM
    MATLAB                                               
    Version 7.0.1      (R14SP1)
    Simulink                                             
    Version 6.1        (R14SP1)
    Aerospace
    Blockset                                   
    Version 1.6.1      (R14SP1)
    Bioinformatics
    Toolbox                               
    Version 1.1.1      (R14SP1)
    CDMA Reference
    Blockset                              
    Version 1.1        (R14SP1)
    Communications
    Blockset                              
    Version 3.0.1      (R14SP1)
    Communications
    Toolbox                               
    Version 3.0.1      (R14SP1)
    Control System
    Toolbox                               
    Version 6.1        (R14SP1)
    Curve Fitting
    Toolbox                                
    Version 1.1.2      (R14SP1)
    Data Acquisition
    Toolbox                             
    Version 2.5.1      (R14SP1)
    Database
    Toolbox                                     
    Version 3.0.1      (R14SP1)
    Datafeed
    Toolbox                                     
    Version 1.6        (R14SP1)
    Embedded Target for Infineon C166 Microcontrollers    Version 1.1.1      (R14SP1)
    Embedded Target for Motorola
    HC12                    
    Version 1.1.1      (R14SP1)
    Embedded Target for Motorola
    MPC555                  
    Version 2.0.1      (R14SP1)
    Embedded Target for OSEK
    VDX                         
    Version 1.1.1      (R14SP1)
    Embedded Target for TI C2000
    DSP(tm)                 
    Version 1.1.1      (R14SP1)
    Embedded Target for TI C6000
    DSP(tm)                 
    Version 2.2.1      (R14SP1)
    Excel
    Link                                           
    Version 2.2.1      (R14SP1)
    Extended Symbolic
    Math                               
    Version 3.1.1      (R14SP1)
    Filter Design HDL
    Coder                              
    Version 1.1        (R14SP1)
    Filter Design
    Toolbox                                
    Version 3.1        (R14SP1)
    Financial Derivatives
    Toolbox                        
    Version 3.0.1      (R14SP1)
    Financial Time Series
    Toolbox                        
    Version 2.1.1      (R14SP1)
    Financial
    Toolbox                                    
    Version 2.4.2      (R14SP1)
    Fixed-Income
    Toolbox                                 
    Version 1.1        (R14SP1)
    Fixed-Point
    Toolbox                                  
    Version 1.1        (R14SP1)
    Fuzzy Logic
    Toolbox                                  
    Version 2.2        (R14SP1)

  • Controlling dialog boxes in a DIAdem script from LabVIEW

    I have a DIAdem script that prompts the user for the data file it will process. The datafile was created from a labview test routine.   I can now run the script from LabVIEW using the "DIAdem Run Script.VI", but in the interest of automation, I would like to have LabVIEW place the filename in this dialog.  I would like to keep the dialog in the script, since sometimes we run this script manually. (without LabVIEW)
    Bill W.

    Bill,
    Which dialog are you using to prompt for the file name?  It
    appears that you cannot send any information to the script through the
    Run Script.vi.  However, you can call automation commands using
    the "DIAdem Run Automation Command.vi".  If you want to pass data
    to the script, then you can set a Global Variable, or a DIAdem Script
    Variable.  As an example, you could use the global variable, T1,
    and send "T1 := 'myfile'".  When the script is executed, that
    variable will be accessible within the script and it will be set to
    "myfile".  You could also set the FileDlgName variable to your
    file name.  Then it may be possible to send those variables to
    your dialog so that they are automatically populated.
    Good Luck!
    Tyler Tigue
    NI

  • Calling Python Script from LabVIEW

    Hello Everyone,
    I want to call the Python script from LabVIEW.
    I tried with using at the command line but i am unable to run that script file..
    i have gone through LabPython but i am unable to call the scripts from there also..
    If someone has an example of a VI which invokes a python script, it will be very helpful...
    Thanks a lot in advance
    Regards
    Avni

    avni wrote:
    I have to invoke the Script file at command prompt.
    Can you descriobe your restriction(s) concerning "invoke the script at the command prompt"?  There may be ways around that.

  • How to call QTP scripts using labview

    Whether any API or dll calls can be used to access the QTP scripts?

    Hi,
    I think there we can execute QTP script from command line. Please look for that option. If that option is there, we can use the same command in LabVIEW cmd line interface to execute the QTP script. Curretly I am using TestPartner which is more similar to QTP.I am executing my TestPartner script through LabVIEW using command line interface.

  • Help with tcl script with labview

    I am trying to run a program using tcl script via labview.
    Currently I am using wish80 tcl to run it. And it works fine.
    I tried using example I found on NI website called Run Tcl Script.vi
    I will attach the vi and the tcl file. Hope someone will have a idea what I am doing wrong.
    Thanks
    please change the testpairs2.txt to testpairs2.tcl as it is not letting me attach as tcl.
    Attachments:
    Run Tcl Script1.vi ‏27 KB
    testpairs2.txt ‏1 KB

    Hi randyram,
    try the referenced labview example with your parameters. I guess there are some changes on the OS. (actual OS with LV6.1 to XP) :-)
    LabView Online Help:
    "Refer to the Calling System Exec VI in the labview\examples\comm directory for an example of using the System Exec VI."
    Mike

  • Python Script with LabVIEW

    Hi,
    I want to call python script from labview and labview vis from python script.
    Can anybody send me any sample code for this using LabPython??
    Regards
    Meenatchi

    Hi Meenatchi,
    see this link http://forums.ni.com/ni/board/message?board.id=170&message.id=308245&requireLogin=False
    [edit] if you download labPython from there, then you get some examples with it. [/edit]
    Hope it helps
    Mike
    Message Edited by MikeS81 on 05-21-2008 04:05 PM

  • Halt script with labview

    let's say I execute a script using the "diadem run script.vi" due to user request.  Later, the user wants to cancel because it was taking longer than expected.
    How do i halt the script using labview tools?
    jim
    Solved!
    Go to Solution.

    Hi Jim,
    This is possible, but not in the way I believe you are hoping.  I know of no way to halt a VBScript running in DIAdem from the "outside".  If you were staring at DIAdem you could hit the <ESC> key, but any subsequent request from LabVIEW will go onto DIAdem's "Script Stack" and will not be executed until the first VBScript is done naturally.
    Of course you have to run all your LabVIEW calls to DAdem asynchronously, or nothing helps.
    So what you can do is set up each VBScript that you think you might want to abort to periodically poll a DIAdem global variable, say "B9", and terminate from inside the VBScript if B9=TRUE.  The command interface from LabVIEW to DIAdem (ToCommand) goes onto the DIAdem Script Stack, but the variable interface from LabVIEW to DIAdem (ToDataSheet) does not.  So you can "poke" variable B9 from LabVIEW while the first VBScript is running and affect it's behavior, but only if and when that VBScript uses that (B9) variable you poked.
    Of course none of this helps if your VBScript is busy waiting for a single VBScript command to execute, and it only helps if your VBScript is running multiple activities, between which it can poll the (B9) variable.
    Hope that helps,
    Brad Turpin
    DIAdem Product Support Engineer

  • Calling perl script from labview

    Hi,
    I have a perl script and I would like to call the perl script from Labview
    anyone can help me with that?
    I used system exec but I'm getting an error.
    Anyone have a working example like calling a simple perl script from Labview.
    Thanks
    SL Ong

    Hi,
    Thanks for the reply from everyone.
    The attached is my code to call Perl script and after calling this, I need to query the Perl Script by sending command like @help. Do they have a way to query the Perl script by sending command like @help and get the return result. 
    I think Joseph you are right, but how do I get the return result if I invoke it in a separate dos session.
    SL Ong

Maybe you are looking for

  • Help understand MSDN solution from SSRS dropdown and SSAS cube?

    Basically, my problem is that the dropdown in my SSRS report is displaying every single day in my Date Dimension, so it's showing everything from 20000101 to 20201231. I would only like to display the dates that are included in my fact table; right n

  • Weird behaviour

    Hello, i have one problem: i call my first jsf site (with user login). If i put the data in the input fields and press command button next, nothing happens. My given date are erased and i have to put it one time more. Then everything works fine. So i

  • Please, please,please help me find a recovery key. Without it I cannot sync, and your instructions don't work!

    I click on the Firefox tab, then "options" and THERE IS NO "Manage Account" and, therefore, NO RECOVERY KEY. Help me, please! Both my computers are Windows: one Win7, one Win8. I've spent hours and hours -- in multiple sessions over a period of month

  • Fixed and Variable set up times CIFing

    Hi All, We would like to CIF both Fixed Set up time (say 30min independent of the previous phase / operation) and Variable Set up time ( which comes through the assigning of Set up group in R/3 recipe and set up matrix maintenance in APO). When I try

  • Where'd my timeline and canvas go?

    I just tried to open up a project in progress by going to File-->Open recent. When the project opens up there is no timeline or canvas. I tried going to window-->arrange-->standard, but they still don't appear. If I just look in window, timeline and