MATLAB script in executable

I made an exe out of a VI that uses a Matlab script. When I run the exe, I get a 1047 error (failed to send variable to script server) even though that error does not appear when I run the VI. I looked at the knowledge base document 1JNEPGU0 and did what it suggested, even though I shouldn't have to since I am on LabVIEW 6.1. I also am using the updated matscript.dll, per knowledge base document 300A6NDT (the VI did not run until I updated this.)
My software is Windows XP, LabVIEW 6.1, Matlab 7.0.4 (R14)
Thanks!

Hi Nick,
I think you are well aware that you indeed CAN interface with MATLAB 7.0 (R14) from LabVIEW 6.1 - that is part of what the KnowledgeBase 300A6NDT
covers. Since you already got that working in the Development System,
the issue must be caused by the fact that you are using an executable
in stead of a VI. Did you follow the instructions specific for executables:
"If using the MATLAB or Xmath Script Nodes
in built applications you will need to also replace the appropriate
DLLs located in the National Instruments\Shared\LabVIEW Run-Time\VERSION\script directory."
If you already did that, we must look elsewhere for a solution. The
following KnowledgeBase also covers an issue with executables and
MATLAB:
Why Does My Executable Hang When It Is Opened When I Use A MATLAB Script Node?
If this doesn't work, please let me know the following:
Are you running the executable on the computer that has the Development System installed?
Is MATLAB open when the executable is called?
What instructions  are you using to build the executable?
Hope this helps!
- Philip Courtois, Thinkbot Solutions

Similar Messages

  • Matlab script in executable won't run

    I'm having trouble with getting a VI with a MATLAB script to run reliably, specifically when built into an executable.
    I'm using LV8.0, Matlab R2006a.
    The VI (not executable) runs properly when I start the computer fresh (i.e. just after a reboot)
    The MATLAB command window opens as soon as I open the VI.
    If I build an executable and run it, it works, so long as I haven't closed LabVIEW and the VI.
    If instead, I attempt to close out LabVIEW and run the executable alone, the MATLAB command window does not start, and the MATLAB functionality is ignored.
    I have updated all of my dlls, and I have checked the box enabling the ActiveX server (though I don't know what to name the server).  I have also read all the associated Knowledge Bases, and found their solutions did not apply.
    I also have intermittent issues running the VI once I have tried running the executable.
    If I make a change to my MATLAB script, I can get the VI to run again, but if it has failed once, the MATLAB command window no longer opens when the VI is opened.
    I can solve this problem by rebooting too, but it seems like there should be a better way.
    Any ideas?

    Hi tblir,
    Can you try to run and build into an
    executable one of the shipping examples (i.e.  MATLAB Script – Fractal.vi)?  Let me know if this exemplifies the same behavior.
    Ecleamus Ricks, Jr.
    National Instruments
    Applications Engineer

  • Matlab Script doesn't execute code

    Hi
    I'm using LabView 6.1 and Matlab 6.5. I have a VI that starts a simulator made in Matlab/Simulink. I need to execute a function in a matlab m file, and I'm using the Matlab Script node to do this. The problem is that the code only executes occasionally. Is there no guaranty that all code in Matlab Script is executed, or am I using it wrong?
    Thanks
    Petter

    You may want to take a look at this Knowledge Base on NI's website. It providess an update for using Matlab 6.5 scripts with LabVIEW 6.x.
    J.R. Allen

  • 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

  • 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

  • Matlab script of labview keeps executing multiple times,

    i have some code for serial communication in matlab , i want to use it in labview for easier and better gui design. for that i have used matlab script node in labview. it seems that labview keep executing the matlab script but i want labview to execute it only once.is there any way to do it?
    Solved!
    Go to Solution.

    i am attaching a vi file. this vi sends 'h' to the com1 continuously but i waant it to send only once.
    Attachments:
    forum.vi ‏7 KB

  • Executing MatLab script

    Hi guys!
    I'm using TestStand to log a bunch of data and save them as binary files. When the test is finished I would like to run a matlab script. At the moment I do this manually, just opening MatLab and changing the path that the script uses to find the particular set of binary files from the test.
    From what I understand you can't use the MathScript function with the base package.
    I don't require anything more than opening mathlab/running the script in the background at at certain point in the test. Could this be done by using a system call and just passing the path as a parameter from a LabView VI?
    Any ides to what is the best approach?
    Thank you for your time!
    Solved!
    Go to Solution.

    You'd be better off posting this question in the TestStand forum, since this is really a TestStand question. In fact, all of your other questions have actually been in the TestStand forum. As far as doing this using a LabVIEW VI, sure you could do it. The VI would contain just a couple of lines of Matlab code to call the script, I suppose. You could also use the Matlab COM server to call Matlab that way. That's how the LabVIEW interface works, so you can just cut out the middle-man, so to speak.

  • 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.

  • 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.

  • 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

  • Getting error when passing variable to Matlab script

    Hi
    I am using LabVIEW 2013 Version 13.0f2 (32bit) and MATLAB R2014b (Version: 8.4.0.150421) in Windows 7 Professional  Version 6.1 (Build 7601: Service Pack 1).
    I am trying to pass measured data to a matlab script to plot but I get errors.
    I have made a small program to make the problem easyer to solve and I get this error
    Error 1050 occurred at LabVIEW:  Error occurred while executing script. Error message from server: ??? Reference to a cleared variable A.
    . in MatlabTest.vi
    I tried the solution mentioned in http://digital.ni.com/public.nsf/allkb/4475BC3CEB062C9586256D750058F14B though it was intended for an older version. This gave me this error instead
    Error 1048 occurred at LabVIEW:  LabVIEW failed to get variable from the script server. Server:"??? Undefined function or variable 'num'.
    " in MatlabTest.vi
    The problem occures when I try to access the input, in other words I can have inputs to my script as long as I do not use them.
    How can I solve this?
    Attachments:
    MatlabTest.vi ‏7 KB

    Thank you so very much.
    I shold of cours have realised that that was what happened but I always use the three clearing lines (close all, clear all, clc) in the beginning of a script to make sure that no old and irrelevant data corrupts my script and did not think about when the inputs were generated.
    Again, Thank you!

  • Error 1050 with matlab script

    Hi , i'v built an vi which sampling saving and playing audio files , i've also added matlab script for data analysis.
    the script tested in matlab and in matlab works great , when im trying to use it in labview i'm getting an error while the matlab sciprt executing . "Error using griddedInterpolant ....."
    i think that the error occures whe trying execute the command : "Sigitp = interp1(clptv, clpsig, tv, 'linear'); "
    moreover i cant figure how to read the saved filed when the loop is finished.
    I cant figure out what is the problem .
    here is the vi : 
    i've also included the vi 

    Cobmetal wrote:
    Im novice to labview , and im learning a lot from NI community , thank you for your suggestion , i will go over it , and try to learn the proper way to implement such tasks in the future.
    Thank You.
    That's excellent!  I believe that if you truly understand dataflow, you will see why your solution isn't the best one.  ASK QUESTIONS IF YOU DON'T UNDERSTAND SOMETHING.  I put that in bold caps because we are here to help you understand and get better. 
    Example:
    "According to what I learned about dataflow, I think this part of my solution mentioned above can look like this.  (Upload picture.)  Does that seem right to you?"

  • Using matlab script

    Hello!
    I'm using matlab script block in my aplication. The m-file (from matlab) contain an 'if' that depends of an input of labview.
    I want to pass trough this condition only once when input's value changes, but labview "covert" this 'if' in a 'while' and pass trough this sequence n times.
    How can I to impose to pass throug the sequence once the input's value change. It's better to specifie it from matab or from labview.
    Thank you in adavance 

    What is surrounding the matlab script block? LabVIEW should be modifying the matlab code, it should be connecting with matlab and matlab executes its code, returning the results to LabVIEW. Can you do a screen capture of the part of the code that contains the matlab stuff? If yes make sure that it is saved as a .jpg (not .bmp!) for size reasons. If not, if you can send the part of your code that includes the matlab stuff that would help.
    P.M.
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • Error 1050 by trying to use load'filename' in matlab script node

    Hi
    I keep getting error 1050 when Labview tries to load a text file through the matlab script node.
    I've all ready checked for it on google and this forum but found nothing. I've also done this: http://digital.ni.com/public.nsf/allkb/2B3FF46C8512C4F786256CF30071BE53 and tried to use dlmread and more. 
    The thing is that  I need the matlab script node to read a txt file that Labview made from a chart with only 1 array, plot it and export a jpg image. I can't really use the 'export image' or 'get image' function in Labview cause I need the whole plotted chart (these functions only take a snap shot of it when they're run).
    This is my code that I'm using:
     data=load('file') ;
    Vpp=(data(1:2000,1));
    xsize = (1/2000);
    plot(0.0005:0.0005:1,Vpp);
    axis([0 1 -5 5]);
    print('-djpeg', 'graph.jpg');
    The usual load in matlab to load txt files and print to print the jpeg. The code works in matlab but not in labview
    And yeah, I'm using windows 7 and legal versions of matlab r2009b and Labview 2009  
    Solved!
    Go to Solution.
    Attachments:
    matlab.jpg ‏213 KB

    Yes I forgot, this is my error...  It looks like it can't read the file path, but the 'file' path is actually just a path to my c:\user\*\*\*\*.txt 
    Error 1050 occurred at LabVIEW:  Error occurred while executing script. Error message from server: ??? Error using ==> load
    Unable to read file file: No such file or directory.

Maybe you are looking for

  • Photoshop Elemnts 12 for mac updates fail to install with Adobe Photoshop Elements 12.1 Update Installation failed. Error Code: U44M1P7

    I get the following error message with Adobe Photoshop Elements 12.1 Update Installation failed. Error Code: U44M1P7 Anyone any ideas please ?

  • FCP won't launch!! SOS!

    *Hello everyone Im new to Mac and to FCP as well.* *From a couple of days while I was launching the FCP 7 for the second time I was surprised by seeing an error report saying: "FCP has quit unexpectedly" i reopened it again and found the same report.

  • XI to XI - XI adapter communication

    Hi    I have the following scenario : BSysA --> XIA --> XIB --> BSysB XIA and XIB are my two integration servers with separate SLDs. Both XIA and XIB have been setup as integration servers in sxmb_admin My aim is to setup a communication between XIA

  • Complex query crashing database!

    Hi Our 10g database runs on Windows 2003 (with 32 GB RAM on server). Whenever a user is running a particular complex query, the database just crashes suddenly. In fact, it doesn't write anything in alert log file for any problem. The user starts the

  • Case time

    until my case for my nano arrives does anybody have any ideas about makeshift cases? I ordered the speak case a LONG time ago. (apparently back ordered) what do I do until then? the protective cover it came w/ is still on...