Matlab script

Hi everyone.
I have a m.file in matlab used to simulate an optical scheme characterized by different parameters.
I
need  to combine different values of these parameters in order to
obtain a kind of calibration. To do this I though to use labview
creating a number of for loops to change the value of each parameter.
Using the matlab script tool in labview the simulation runs ok.
To
change one parameter, for example Alfa_laser,  I created an input
linked to the control and attached to the script. At this point, the
simulation does not work.... and  I don't know why!!!!
Someone can help me
Thanks
matomato
Attachments:
simulator.vi ‏51 KB

matomato wrote:
To
change one parameter, for example Alfa_laser,  I created an input
linked to the control and attached to the script. At this point, the
simulation does not work.... and  I don't know why!!!!
Someone can help me
You have no inputs for the script node, so there is no link. All that you have is an output node tied to an array indicator. That's probably why the simulation doesn't work. Also, you have no loop. Do not use the "Run Continuously" button if that's what you're trying to do. 
To learn more about LabVIEW it is recommended that you go through the tutorial(s) and look over the material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. You can also take the online courses for free.

Similar Messages

  • Retrieving data from a MATLAB script node

    I am creating a VI that imports and manipulates arrays of data points and then plots them in Labview. When I run my Matlab script in Matlab there are no errors and all the assigned variables exist in the form that they should exist but for some reason Labview cannot retrieve all of them (they just show up as zeros). There are no errors in the script as far as I can tell. Do you have any idea what could be going wrong?

    Hi,
    You can use the MatLAB window opened by LabVIEW to debug your script.
    Check the values of your variables in the MatLAB window and try to find out where the data goes wrong. I've experienced many problems with LabVIEW MatLAB nodes on different PCs, and many times legal MatLAB operations would go wrong in the script node. You will need to find out which line exactly does your MatLAB code not executing correctly and try to modify the MatLAB codes from there.
    Hope this help,
    Dan

  • Matlab script no longer works after upgrade of matlab

    First of all im using labview 7.1.1 to execute a vi which uses some labview scripts to do the bulk of the number crunching and  labviews excellent interface.
    The problem happened when i recently was forced to use Matlab 7.1 R14 SP3 because some of my other routines required this.  After i had upgraded matlab and tried to run the labview vi, all i keep getting is an error no. 1050 from the matlab script object.
    Now the most infuriating thing about this is that it is such a non descript error, i mean , what does it actually mean? and as such i dont even know where to start in solving this problem.
    Has anyone solved this problem or indeed had it themselves, im at the end of my tether with it now.
    Thanks for your help
    Neil

    This is a known problem between different version of Matlab and LabVIEW. Mathworks changed the Matlab interface with version 7, which broke a lot of LabVIEW code. Which version of Matlab were you using before? You can try searching these forums for "matlab error 1050 labview" and you'll see what I mean. Typically he problem is the version of the matlab.dll that's in the LabVIEW installation directory. You can try the stuff suggested in this article.

  • Error produced when trying to pass variables to a Matlab script

    For some reason, LabVIEW produces an Error 1047 (Unable to pass variable to the script server) whenever I create an input variable to a Matlab code block.
    Outputs work fine (for example, connecting an output "a" to a Matlab code block that says "a=rand(50)" correctly produces a 50x50 array of random numbers that can be displayed in LabVIEW). However, creating any kind of input node, whether or not the associated variable is mentioned in the MATLAB script, brings up an error 1047.
    Any ideas what could be causing this? I'm using LabVIEW 7.0 and MATLAB 7 (R14). I've read the article
    >here and that's not the problem, and I've also updated my matscript.dll to the latest version, 7.0.0.2, which also made no difference.

    For what its worth,
    I work in a company with a lot of Matlab users, and I,m programming in Labview and Matlab.
    When I create a testrig measurement I always have to convert data into Malab format, so I used the script server a lot... exept we have a limited pool of Matlab
    licenses so my work was halted whenever the licences where gone.
    So I wrote a Write2Matlab vi.
    This vi can log data from a measurement and write it in a Matlab readable file format (Matlab6 R12).
    After logging you can append more data. It works with(Double,Single,Int32,Int16,U16,U8,String) matrix see for yourself in an example (Write2matlab_test.vi).
    Perhaps this is an alternative solution for your problem.
    Please send me a reply if you find it usefull.
    John
    Attachments:
    Write2Matlab.llb ‏1145 KB

  • How to insert data from file into matlab script node

    I have interfaced input data from file to be processed using matlab script node. But the problem is that I could not capture the multiple data into matlab script node and to convert it into matrix. Further to this I need to process the data by plotting graphs from it. Thank you in advance for the advice

    Zarina,
    To clarify your problem, you have a script node contaning your Matlab code. Are you then using the standard LV functions to load in your data from a file and pass it into the script node?
    Regards
    Tristan

  • How to call a function in "matlab script"

    Hellow!
    I am using Matlab scrip to make some matlab program in Labview,but i find when i try to call a matlab function like"myfun.m",it will ouput error message"undefined command myfun. So what should i do to call function in matlab script? thanks!

    Happybird,
    Do you have MATLAB installed on the computer?  LabVIEW makes calls
    to MATLAB to run the script node.  If so, make sure that you have
    launched MATLAB and then launch LabVIEW.  Once you have tried
    that, <a
    href="http://digital.ni.com/public.nsf/websearch/4475BC3CEB062C9586256D750058F14B?OpenDocument">KB
    300A6NDT</a> might be helpful.  Hope this information helps!
    Andy F.
    National Instruments

  • I can't find the MATLAB script node in labview

    We are using a MAC G4 with OS 9. We also have labview 5.1. I have looked under Mathematic>>Fomula in the tools palette and I cannot find the MATLAB script node.
    Is there an extra download that I need to get this MATLAB script node?

    The HIQ and MATLAB script nodes are only available in the full and professional development systems. If you have one of these versions, these nodes should be under the Mathematics>>Formula palette.
    If you have the base package of LabVIEW, you will not have access to these script nodes. Details about which options are included in which development packages can be found at:
    http://www.ni.com/labview/devchart.htm

  • Error occured while executing Matlab script

    Hello!
    I want to run a Matlab script under LabVIEW, but there is always
    a error message which says "Error occured while executing script".
    Should I install Matlab on the same computer at first? if yes, do
    I need to configure Matlab under LabVIEW?
    Thanks!
    Le

    Yes No
    Eric P. Nichols
    P.O. Box 56235
    North Pole, AK 99705

  • How to load a variable using MATLAB Script?

    I need to load a selected variable from .mat file, using MATLAB script , and analyse it.
    the attched shows my vi, there are two inputs nodes 'file' contains the .mat file path, and 'varn' contains varibale name in that .mat file which can be selected by user. Using " load(file)" the whole .mat file is loaded in the workspace and become avaiable at output node, however I am not able to pass a selected variable name through string "varn" input, MATLAB script does not recognize the variable.
    any idea to reslove it is realy appreciated.
    Attachments:
    load a variable.JPG ‏18 KB

    Download the VI and .MAT file. Run the VI, and it'll plot the data inside of the .MAT file.
    Andy Chang
    National Instruments
    LabVIEW Control Design and Simulation
    Attachments:
    testfile.zip ‏5 KB

  • Input data type of Matlab script node

    Hi,
    I have 1D array of complex number in single precision.
    Matlab script node is used to import data into Matlab and do some data processing, and then export.
    Data type of input is currently double precision.
    How to re-define this input data type of the Matlab script node?
    Thanks,

    Right, arrays of singles are not supported. See Comparison of MathScript RT Module and the MATLAB® Software Data Types in LabVIEW
    As for memory usage, Profiling the VI should let you know how much memory Labview uses when running your code. Communication with MATLAB® is done through ActiveX, and I'm actually not 100% sure whether it will reflect memory usage from script execution. I think it'll be simple enough to profile your VI with and without the MATLAB Script node and note the memory usage difference...
    Misha

  • Using '!' in matlab script

    It seems unable to invoke the '.EXE' file in the matlab script node.
    In my matlab code I use '!' to invoke a .exe file, it can be execute in matlab, but when I copy the same code to labview(matlab script node), it does not work
    the error messages are
    LabVIEW:  Error occurred while executing script. Error message from server: Warning: Name is nonexistent or not a directory: D:\Wastewater_experiment\programCodes\DymolaFiles.
    > In c:\matlab6p5\toolbox\matlab\general\path.m at line 116
      In c:\matlab6p5\toolbox\matlab\general\addpath.m at line 88
    < c:\matlab6p5\bin\win32\dsu.txt created.
    ... Error message from alist
    Error opening file "dsin.txt": No such file or directory
    ??? Error using ==> load
    Unable to read MAT file temp.mat: not a binary MAT file.
    Try LOAD -ASCII to read as text.
    Error in ==> C:\dn\programCodes\initload.m
    On line 43  ==>      load temp
    Error in ==> C:\dn\programCodes\operatingPoint.m
    On line 17  ==> [x_init, x_name] = initload; % loads initial conditions from txt-file 'dsin.txt'.
    . in labviewmatlab.vi
    I am sure I have add all the path. and If I just run the code
    ! alist -a dsin.txt dsintest.mat
    in matlab script node. There is no errors but it can not be execute.
    This alist.exe file is from 'Dymola' to transfer the 'txt' to 'mat'.
    How can I do with this error
    Attachments:
    labviewmatlab.zip ‏52 KB

    Sorry
    The problem have solved.
    When I invoke .txt .mat .exe in LabVIEW matlab script node, this files should be under '.../matlab' path. I do not kown why it is not '.../matlab/work'.And 'addpath' is useless except to 'invoke .m' files.
    It can work now.

  • I have some software problems of running matlab script node in the LabVIEW program.

    Hi there,
    I wrote a simple matlab code, like x= 1, y = x*2. Then I tried to put them into matlab script node in LabVIEW.
    However, when I ran the program, I couldn't run and Labiew show some error. 
    Then I tried the method talked before on this forum. Please see the following link.
    http://forums.ni.com/ni/board/message?board.id=Mat​hScript&thread.id=571
    I followed the instruction and open the "command prompt," type some commands then I could run the program, and simultaneously, the LabVIEW program open "Matlab command line window" and run my labview code. However, if I didn't use the command prompt, the  "matlab command window" will not be opened by running the labview program. It would just show some error. And even if I turn on the matlab program in advance, I still couldn't run the labview program.
    Is there any effecient way to deal with this problem without using "command prompt?" Because I try another PC with both matlab and labview installed on it, I "can" run my simple matlab script node on it, and it will open the matlab command line window automatically by running my code. Therefore, I thought there might be some software linking problems in the previous PC I used . Do you have any ideas?
    Thanks in advacne.  

    This board is for Mathscript, but you seem to have a matlab problem. You should probably post in the LabVIEW forum instead.
    What is your LabVIEW version? What is you matlab version?
    LabVIEW Champion . Do more with less code and in less time .

  • IMAQ FFT multiplication and MATLAB Script Nodes/Compact Rio

    I would like to automatically generate a frequency kernel to multiply with the FFT of my IMAQ image. I was wondering if there was a way for LabVIEW to automatically set up 2D arrays (with a lower bound, a step size and a higher bound) like what is done in MATLAB.
    I was wondering also, if someone could give me some insight as to what restrictions I face, when uploading code from MATLAB script nodes into the Compact RiO (I have a cRiO-9025).

    Hi Bilaln,
    I think you confused about a MATLAB script node and a Mathscript node.
    A MATLAB script nodes uses ActiveX to call into MATLAB, where as a Mathscript node runs in a NI built environment. The MATLAB script node requires both that MATLAB be installed and the host supports ActiveX. Since cRIO does not do either, you should use the MATHSCRIPT RT module.
    Joe Daily
    National Instruments
    Applications Engineer
    may the G be with you ....

  • Using array as a MATLAB script input in a subVI - labview crashes

    Hello
    I am having troubles in creating a subVI that includes a matlab file which has an array as an input.
    I have created a VI, that executes a simple matlab script, having an array as an input and an array as an output. This worked fine, untill i assigned the terminals in order to use it as a subVI.
    After the terminals have been assigned, labview instantly crashes when running the file.
    I also created a VI to test the subVI, but I couldn't get it to work at all, labview always crashed...
    Does anyone know a solution to my problem? They only thing i can think of is to not use it as a subVI, but then my main file will get huge, as all the matlab code would be included in there...
    attached are both files, so that you better understand my problem. (test_... is the main file)
    any help will be greatly appreciated!
    - Jarno
    edit: I'm using labview 2013 with windows 7 and matlab 2014
    Solved!
    Go to Solution.
    Attachments:
    test_subVI_array_into_script.vi ‏8 KB
    subVI_array_into_script.vi ‏8 KB

    Hey Jarno, 
    I did some playing around with this (sorry for the delay) and another workaround we can use is adding an Always Copy to the array before passing it into the Script Node. This will allow you to continue using Double precision arrays instead of going to Singles.
    It looks like there is an issue with the array copy that is passed into the SubVI through the terminal, but we can get around it by making a new copy that the Script Node can properly work with. 
    Tim A.
    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

  • Matlab syntax errors are not caught and reported when code is executed in a LabVIEW Matlab script node

    I want to be able to catch errors that occur during the execution of Matlab code in a LabVIEW Matlab script node. According to my understanding of the documentation, errors of this type should be available at the "error out" signal point on the Matlab script node. I have noticed that even deliberately generating matlab syntax errors will not produce an error output. See the attached vi for an example.
    Attachments:
    matlab.vi ‏13 KB

    I ran your example VI and the is what I got in the Error Out cluster:
    "Code 1050
    Error occured while executing script. Error message from server: ??? This is an error
    . in matlab[1].vi"
    If you are generating custom error messages in Matlab I would suggest passing them back to LabVIEW through output variables in the script node.
    Chris_Mitchell
    Product Development Engineer
    Certified LabVIEW Architect

Maybe you are looking for

  • Help with NSAPI...loads, but doesn't execute

    Trying to write NSAPI plugin to write a cookie to every request. OBJ.CONFI entries: Init fn="load-modules" funcs="setSessionCookie" shlib="C:/Data/Test_Cookie.dll" Service method="(GET|HEAD|POST|PUT)" fn="setSessionCookie" CODE: NSAPI_PUBLIC int setS

  • Printing a quotation mark (") in concatenate formula?

    Hi, I'm trying to write a function using  =CONCATENATE() and I want to know how to add a quotation mark to the output without it screwing up the forumula. This doesn't print out the quotation mark " between B2 and B3: =CONCATENATE(B2,""",B3) I've bee

  • CSM probe debugging

    Hi, i've tried to debug a non-scripted probe on my csm, but i can't see any output. What does the message "Health Monitor quiet mode: output error messages" mean, and how can i make those messages visible? TIA, Stephan

  • Error during OWB10gR2 Installation

    Hi, I am facing following error during Oracle Warehouse Builder Installation on Solaris x86. During installation Universal Installer prompt following messege: Error in invoking target 'isqlldr' of make file '/u01/app/oracle/product/owb10.2.0/rdbms/li

  • Testing of applications / updates before deployment or within an OSD image

    Hi I know this might not be the best place to ask for this, but since this is also related to Sccm, here i go... I guess Windows Updates and new applications are the two most common examples where an issue might break critical applications and you wo