Undefined output Matlab Script

Hi guys,
             I have some problem in using the Matlab Script. Currently, I have defined my output variable but however, the error kept prompting that there is undefined output. I wonder what is exactly the problem and how could I resolve it? Thanks a lot for assistance and sincerely appreciated.
Rdgs
kengkc
Solved!
Go to Solution.
Attachments:
error.PNG ‏109 KB

Hi,
Refer to this great KB which explains why you are getting this error message.
Hopefully this helps.
Regards.
Steve M.
National Instruments France
#adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
>> Vidéo-t'chats de l'été : présentations techniques et ingénieurs pour répondre à vos questions

Similar Messages

  • Outputting of of a Matlab Script

    Hello everybody
    I am working on a project for school and had a question as far as outputting out of a Matlab Script node. I have data that is stored in the form T(:,:,i) so it is a 3D data that is calculated within the the script. 
    The main thing I am wanting to do is output the data so I can graph it on a Labview front panel. I want to display a 2d image with a third dimension respresented as points on that 2d image. (2d as space with 3rd dimension being temperature).
    It may not make sense why I am doing this in Labview but I have an entire GUI built for Labview and this is just one snippet of the things that I want to show. I included a file for the particular graphs I am trying to ultimately display. 
    I apologize I am still learning the ropes to Labview.
    Solved!
    Go to Solution.
    Attachments:
    PowerSimForForum.vi ‏11 KB

    Hi Jakeyboy1,
    Below is a link that demonstrates how to send a 3-Dimensional array from LabVIEW, however you should easily be able to modify the block diagram in the article to switch the processes.  In the article, the example code first auto-indexes a 3D array to assign T(:,:,i) within the script environment.  Then LabVIEW uses another script node to process the built 3-Dimensional array.
    You can switch this process.  Out of the first script node wire out the length of the 3rd dimension and feed that into the N terminal of a for loop.  Within the for loop place the script node which reads T(:,:,i) and outputs the 2D array from the node.  You can wire this out of for loop and autoindexing should creat the 3D array in LabVIEW.  Since the N terminal matches the length of the 3rd dimension.  The resulting array in LabVIEW should be identical.
    Send N-Dimensional Arrays into a MATLAB® Script Node
    Regards,
    Isaac S.
    Applications Engineer
    National Instruments

  • Matlab script outputting different data

    Hello
    Fell into the problem of getting different output on graph from matlab script node.
    I apply welch function in matlab over a data and ouput 2D array onto waveform chart.
    however the output plooted by matlab plot command has different amplitudes than the labview graph.

    alpine_t wrote:
    however the output plooted by matlab plot command has different amplitudes than the labview graph.
    There are millions of ways things can be different, so you need to be a little more specific. Is it just a scaling issue? How different are they? What are the offset and multiplier settings for the y-axis of the graph?
    You use the terms "chart" and "graph" interchangeably but in LabVIEW they mean very different things. So what is it?
    LabVIEW Champion . Do more with less code and in less time .

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

  • 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

  • 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

  • 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

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

  • 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

  • BUG found while running Matlab Script

    Hi there,
      I am trying a very simple vi exacmple for learning MathScript. My labview is 2011 and my matlab is 2011b, they both install in the same computer. My OS is windows 7 (64bit). I am trying to writing the following script to the block
    t=0:0.01:3;
    y=sin(t);
    while y will be the output name of the MathScript. I connect this symbol to the a graph and run the program. For the very first time, it call out the matlab platform and run the program directly and the result was shown in the graph. However, whenever I want to modify the script and trying to save the vi, it reports some error and the program get terminated "DAbort 0x1A7102DF in fpsane.cpp". It is so weird. If I open the closed VI again, it can run without any problem for the first modificaiton, but the problem comes again if I modify the script again after the first run.

    Sorry, I currently don't have matlab installed, so I cannot test your VI containing the matlab script.
    If I copy the text of your matlab script to a MathScript node instead, everything works just fine.
    It is possible that the problem is within matlab and not a LabVIEW problem. I cannot tell.
    MathScript is a LabVIEW toolkit that can run scripts with a matlab like syntax. You need to purchase it seperately (windows), but you can also download an evalution copy to try for free. The version for Mac and linux seems to be free but I have note tried. Are you a student? The LabVIEW student editions also include MathScript.
    LabVIEW Champion . Do more with less code and in less time .

  • Using matlab script block

    Hello!
    I'm using a matlab script block and I have a problem that i don't how to solve it,
    I want to import a column that in matlab is cell array or char array type. When you create an output in matlab script block you have to specify the data type....I choose string, but with this option you can only import one string....and I want to import a whole column.
    Someone knows how I have to do to import this data type? I have to do some changes to the data from matlab or I have to use some especific block in labview to adapt the data.
    Please help me!!
     Thanks!!!

    Ooooppss!
    My computer is crazy....sorry.
    I'm near to solve my problem...
    The problem is that I have a column of strings like this
    str=['labview'
            'labview2'
           'labview3'
            'labview4']
    I use the double command but the byte array to string block only converts me an element, do you know is exist another block to change all the elements.
    I've tried to do with a for loop block....using an index array and changing with i the index element, but it doen'st work.
    You have some idea?

  • Using a 3D matrix with a matlab script block

    Hi all of you,
    it is possible to input a 3D matrix (e.g. 10x4x20) to a matlab script block or you have to unfold this data in a 2D array?
    Do you know what i have to do to input directly a 3D array (array of real numbers) to a matlab script block.
    P.D.; I'm using labview 7.0 and matlab 6.5
    Thank you very much
    Larson

    Hi,
    as far as I know there is only the possibility to have an input for a
    2D array to matlab scriptnode. Thus you should convert your 3D data to
    2D in LV and reconvert it in your matlab code into 3D.
    When you select 3D data as an output of a script node it automatically
    appears as 2D (but no data will be lost). So when you have to use it in
    LV again as 3D data, what you have to do is reconvert it back from 2D
    to 3D.
    Hope this helps!

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

  • Possible threadsafe issues using Matlab scripts?

    Hi all,
    I'm developing an application in Labview 6.1 that makes extensive use
    of Matlab scripts.  The application executes the same set of
    scripts for multiple data sources, and keeps track of the inputs and
    outputs for each data source separately.  I've been noticing that
    the application produces the correct results when running only one data
    source, but that the results are often incorrect when I run it against
    multiple data sources.
    I've done some investigation, and have found that all Matlab scripts
    share a common memory workspace in Matlab.  That is to say that if
    I have ScriptA that takes variable X as an input, and ScriptB that does
    not, ScriptB nonetheless has access to variable X in its workspace
    (from the last time ScriptA was called).  This doesn't pose a
    problem to me directly, but it has made me wonder if there are
    potential threading issues in the scripts.
    Consider the following scenario with one script and two data
    sources.  I'm wondering if this scenario is possible in Labview:
    1.  Thread1 calls ScriptA, passing data from SourceX.
    2.  During Matlab execution (somewhere in the middle), Thread1 is suspended.
    3.  Thread2 calls ScriptA, passing data from SourceY (data have the same variable names, since it's the same script).
    4.  Thread2 finishes ScriptA execution uninterrupted with SourceY data.
    5.  Thread1 is reactivated, but now the Matlab workspace data has
    been replaced with SourceY.  So, Thread1 started with SourceX
    data, but finished with SourceY data.
    6.  An incorrect result for Thread1 is produced, because the wrong data was processed.
    Clearly I could get around this problem with a semaphore, but first I'd
    like to know if this scenario can even happen.  Are Matlab scripts
    treated as atomic operations in Labview, or can the threads be
    suspended midway through execution?
    Thanks for your help!
    cjb

    Hello,
    No. LabVIEW will definitely not compile a VI while it's running - I think that would be, even conceptually, impossible.  In fact, some properties (accessed via property nodes) are not editable at run-time for basically that reason, that a recompile would be necessary in order for the affect to take place, and the recompile can't take place at run-time!
    It is indeed strange behavior, particularly because it is intermittent (which does hint at a threading issue, or some factor outside the development environment).  Can you try moving the initialization to LabVIEW?  I have attached an example of a so-called functional global variable (a simple code module in this case).  It has two "states" (which are cases) - one is initialize and the other is the "usually executing case."  The initialize case is used to initialize the shift register to an array of 50 doubles, where the other case will compute the running average, min, and max across the 50 most recent random numbers generated.  The 50 data point code module.vi is the code module, and it is called by Use 50 data point code module.vi.  When you run Use 50 data point code module.vi, be sure to toggle the initialize boolean so that the initialize case executes once to allocate and initialize an array with 50 elements; when you toggle it back then it will execute the other case on each iteration, and begin computing the statistics noted by keeping an array with the 50 most recent random data points generated.
    I hope this helps and that you are able to incorporate a similar code module into your application to avoid the intermittent errant behavior!
    Best Regards, and feel free to post again with updates!
    JLS
    Best,
    JLS
    Sixclear
    Attachments:
    Use 50 data point code module.zip ‏27 KB

Maybe you are looking for

  • Imy iPhone sounds are not working. Any help please

    I have an iPhone 4s. I Powered it offhand when I opened it again all the sounds like the keyboard sounds and the sound u here when u unlock the phone. Even the music in games are not working. However, when I listen to music or watch videos on YouTube

  • Depreciation run for previous years

    Hi Experts, I am in Development system where the depreciation run has not been carried out since 2007 as per OAAQ. Now when I try posting depreciation for year 2008 period 1, it throws this error "You can only post in new year after closing previous

  • How can I render audio in After Effects CS6 without it stopping in :30 seconds?

    I imported my files from Premiere Pro CS6. I rendered in Premiere Pro prior to importing it to AE.

  • Trouble with popup not initialized until addPopUp is called

    I am having troubles with initialization.  I have a class given below.  I new() it at the start and use PopUpManager.addPopUp to display it. My problem is that the line query:QueryWIthOption id="filterComp" is a class with a lot of variables.  Howeve

  • Export from 8.1.7 to 8.1.6

    Hi, I try to export tablestructures from an Oracle 8.1.7 database (Personal Oracle) to 8.1.6 (Network version). I do the export with the exp command in a dos-box. I understand that I need the export 8.1.6 tool but where can I download it?? Thanks in