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);

Similar Messages

  • 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

  • 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

  • How to call Python Scripts throght Labview

    Hi all,
    I am new to this community. Need some inputs  for following Questions
    Questions:
    1)  How can I call python script from LabView?
     (Basically this python script calls some other DLL and print some message, to run the script using Python net in my application .To run my script in python net using following commands: import python script name )
    2)  In how many ways we can call Python scripts from labview?
    I have tried with this option "System Exec.vi "in labview , able to calling pythonnet but unable to send commands and arguments to run python script(i.e  import python script name ). 
     If anyone have samples".VI " please send to me. If you people want any information and clarification  from my side please let me know. Thanks in advance.
    Regards,
    Sambasivareddy

    One way is to create a client server app and to send arguments to python (and back) over TCP/IP. This work very well.
    There is an example on the old OpenG Website about this. Look it up.
    Python client to LabVIEW Server.
    PJM
    Message Edited by PJM_Labview on 03-12-2008 09:00 AM
    Got EasyXML?
    JKI.VIPM.EasyXML.OpenG.LAVA.Builder.blog

  • Error while runing diadem asynchronous script from labview on dual core processor

    Urgent need of some help / advice here!
    Single core runs fine... dual core produces error: Error in <XYaxis.vbs> (line: 17, column: 1): Error while opening object. The object currently open has no subobjects. Forgotten ObjClose?
    The main software built in labview used for daq and analysis generates a PDF report on completion of a test, utilising diadem. For this I use the diadem express vi in labview to generate a multi page report, whereby I use for loop to iterate an array of channels for each page. This for loop has a shift register too. After each page I run a script to adjust a few parameters like linear/log, begin/end and line thickness using the diadem connectivity tookit. See script below:
    Call GraphObjOpen("2D-Axis1")
    Call GraphObjOpen("2DXAxis8_1")
    D2AxisXDivMode = "linear"
    D2AxisXScaleType = "begin/end manual"
    D2AxisXBegin = 20
    D2AxisXEnd = 20000
    Call GraphObjClose("2DXAxis8_1")
    Call GraphObjOpen("2DYAxis8_1")
    D2AxisYDivMode = "linear"
    D2AxisYScaleType = "complete automatic"
    D2AxisYBegin = 0
    D2AxisYEnd = 0
    Call GraphObjClose("2DYAxis8_1")
    FOR c = 1 TO CurveNoMax
    If D2CurveObj(c) = "" Then Exit For ' c
    Call GraphObjOpen(D2CurveObj(c))
    D2CurveLineWidth = 0.75
    Call GraphObjClose(D2CurveObj(c))
    NEXT ' c
    Call GraphObjClose("2D-Axis1")
    There is also a screenshot of the vi: (script file is generated by the Dscript vi and saved to disk. then path is passed to the diadem script vi.)
    What I find is, after the first report page is complete in diadem the second page ALWAYS shows the error as shown at the top. However, on my P4 laptop with single core (no hyperthreading) its runs FINE EVERY TIME with any given number of channels/pages in the report.
    My current chain of thought is that the superfast dual core is doing something in parallel therefore not waiting for the previous page to complete or finish closing its object!? however, in my for loop I use a shift register as named before, surely this kind of loop cannot be divided over more cores/parallel threads? as it has to wait for the response of the previous.!?!? Im running LV 8.6 on WinXP for this project and I didnt even think multicore processing for for loops is included in this version.
    The other thing is... this script used to run fine on the dual core until I added the last part that uses a for loop to get every line of the graph to be the thinkness I need. Is this for loop the culprit? Can I stop it from executing over multiple cores/threads? I read a post saying that from diadem 8 there was multi core support. this triggered my doubt
    As always any comments are most appreciated
    AL
    :. LV2010 SP1 ... W7 .:
    Solved!
    Go to Solution.

    Hi Al,
    I have a theory, but only you can test it.  In your VI screenshot, you have the boolean input for the DIAdem Execute Script.vi set to asynchronous=TRUE.  My theory says that if you change that boolean (and all others like it) to asynchrous=FALSE that the error will not occur on the multicore computer.  The other thing you could try would be to consolidate all REPORT commands that pertain to one REPORT page into a single ActiveX call to DIAdem.  In the screenshot below you have at least 2 separate VIs calling DIAdem, so that's at least 2 separate ActiveX calls for one REPORT sheet.
    Here's what I think is going on.  On a multicore computer there is the potential for different ActiveX commands from LV to DIAdem to execute on different cores, which may result in a timing problem on the DIAdem side.  DIAdem 11.x and earlier runs exclusively on 1 CPU, so the incoming ActiveX commands should be sequenced correctly by DIAdem's ActiveX to-do list.  Theoretically DIAdem should serialize all the incoming ActiveX commands (regardless of which CPU processed them) in the order that they arrived at the DIAdem ActiveX server(s).  On the sending side, LabVIEW's dataflow execution should theoretically guarantee that all the ActiveX requests are being sent in the correct order.  But it is theoretically possible that the operating system's ActiveX processing queue might not send all the ActiveX commands to DIAdem in the order that it receives them from LabVIEW-- IF YOU'VE SELECTED ASYNCHRONOUS PROCESSING.
    See if these clues help,
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • Loading and running consecutive scripts in LabVIEW

    Hello, 
    I'd like to start this by saying that I'm very new to LabVIEW so I apologize for any questions that should seem obvious. Also, when replying please remember I'm not as familiar as I would like to be with LabVIEW in general. I have recently had a problem put on my desk to add some functionality to a preexiting, fairly complex VI. The solution seems to be in scripting. However, loading a script longer than 55 lines gives an error (Is this normal? Is there a way around it?). The problem is pretty easy to break up into small parts, so the script has been broken up into multiple smaller parts that provide the same function when ran consecutively. After executing each script, the system will take some time to process (up to 300ms, IIRC) and will assert a ready bit when complete. Using that ready signal as a trigger, I would like to execute the next script.
    The scripts are being read correctly into the program using "niHSDIO Write Script.vi", and can be selected by hard-coding the 'script name' into "niHSDIO Configure Script To Generate.vi". It will successfully execute any of the scripts when hard-coded, but when trying to call the next script (script names stored in an array, and incremented with a while loop) an error is given:
    Error - 1074118651 occurred at niHSDIO Write
    Script.vi
    Possible reason(s):
    Driver Status: (Hex 0xBFFA4005) You cannot perform this
    action while the session is in the running state.
    At this point, I've read quite a bit online and in the documentation about trying to find a way to suspend, pause, etc. the state to allow another script to load, but I haven't been able to figure it out. 
    On the other hand, if there is a way to load a script of arbitary length, I believe that will resolve my problem as well. Please let me know what additional information may be needed to help solve this, as I'm sure I've left out all the good bits. 
    Thank you in advance, 
    Landon
    Edited for clarity. 

    Good morning Jonathan, 
    Thank you for your reply. I apologize for the delay in my response. Allow me to back up a little and give you some more information on the script. 
    The error is as follows: 
    Error - 1074116601 occurred at niHSDIO Write
    Script.vi
    Possible reason(s):
    Driver Status: (Hex 0xBFFA4807) Too many compiled
    instructions in loop. "Generate" and "Wait"
    instructions each result in at least one compiled
    instruction. Each marker adds an additional compiled
    instruction. Clear instruction does not result in a
    compiled instruction.
    If possible, reduce the number of generate instructions
    by concatenating the waveforms on two or more
    consecutive generate instructions.
    Line Number: 2
    Position in Line: 1
    Number of Instructions: 2048
    Maximum Number of Instructions: 55
    Status Code: -201016
    I have a waveform that is 524292 cycles long and I want to run 384 cycles, wait for an external trigger, run another 384 cycles beginning at a new position, wait for the same external trigger, and loop that 1024 times.  I thought scripting would work, but if there’s a better way please suggest it! I’m using a PXI-6551 with  64Mb/chan RAM in a PXIe 1062Q chassis with a PXIe-8370 controller cabled to a desktop Windows 7 box.
    As previously mentioned, the smaller scripts function correctly when split into sections of less than 55 lines. See below for an example functioning script. 
    Clear scriptTrigger0
    Generate mywfm subset(0,384)
    Wait until scriptTrigger0
    Clear scriptTrigger0
    Generate mywfm subset(512,384)
    Wait until scriptTrigger0
    Clear scriptTrigger0
    Generate mywfm subset(1024,384)
    Wait until scriptTrigger0
    Clear scriptTrigger0
    Generate mywfm subset(1536,384)
    Wait until scriptTrigger0
    Clear scriptTrigger0
    Generate mywfm subset(2048,384)
    Wait until scriptTrigger0
    Clear scriptTrigger0
    Generate mywfm subset(519168,384)
    Wait until scriptTrigger0
    Clear scriptTrigger0
    Generate mywfm subset(519680,384)
    However, when the full script (attached in text file) is entered, the error is generated. 
    Thank you again for your time. Please let me know any additional information you may need. 
    Landon 

Maybe you are looking for

  • Read a text file and put the text in a TextEdit UI

    I have found code sample for reading file inside webdynpro, but I can't manage to make it works with a text file on the web (ex.: "http:/.../file.txt"). Can someone post the exact code needed for that? Thanks!

  • MLS implementation - Oracle Apps 11i

    Can anybody answer by following questions: 1)What is Localization? 2)How to add new language (Japan) to an existing 11i instance?? 3)Is it possible for a user to see the data in English which was input by an Japanese user in Japanese lang and vice-ve

  • HANA, Aggregations and calculating percentages

    I have a table containing user-role assignments, e.g. the table contains tuples of the form (userA, roleA), (userA, roleB). Now, I would like to get an overview on how the distribution of users across roles. I would like to get the following overview

  • Nokia 6300 driving me crazy

    Hi,just got a nokia 6300 about 3months back only for me to notice yesterday that it was rebooting itself and when i turned it off and tried putting it on back but everytime i press the power button, the blue lights on the side stay on. After much att

  • Zcm 11.2.4 preboot server not responding

    At least since update 11.2.4 can no longer do imaging. I am pretty sure I was doing imaging fine in 11.2.3a, certain in the 11.2.2 level. receive "Preboot server not responding. The product license might have expired." is not expired, license state s