MathScript instability with large Matlab scripts? (Labview 8.5.1)

Hello

I the student of LabView 8.5.1 version and experiences a lot of instability when you use Mathscript in Labview (the Mathscript block or the Mathscript window), but only when it comes to the larger scripts. The Matlab script is about 250 lines long and 16 KB of size and in this framework, are seven large paintings (six 14 x 8, built at the beginning and a 1000 x 9 which is built in a loop for, so increases with each iteration until 1000 lines). I find that whenever I have modify the script in the Mathscript node or the Mathscript window will freeze and hang for at least 10 minutes, sometimes totally crashing Labview Labview. As I wrote the script in Matlab, I'll have to debug in Labview and know what commands in Matlab do not work in Mathscript/Labview, so it's obviously pretty infuriating to have the program regularly hang for 10 minutes at a time.

The computer I use is a desktop Packard Bell 5 year with 768 MB of Ram (less 32 MB integrated graphics card), running XP Pro. The processor is an Intel Celeron 2.6 GHz. I appreciate this isn't the best specced machine ever, but at the time it was all I could afford!

Is this common suspended a little problem with Labview and Mathscript file ".m" large, or is manipulation - this purely down to my old computer?

Thank you much for the help.

Hello

The delay that you experience is a problem with the big scripts in MathScript.  The delay increases exponentially with the length of the script.  For this reason, we recommend disaggregation great scripts and files ".m" in rooms separated by about 40 lines.  On faster computers, you can find the acceptable period for up to 100 lines.

Grant M.
Staff software engineer | LabVIEW Math & Signal Processing | National Instruments

Tags: NI Products

Similar Questions

  • LabVIEW 8.5 problems using strings with MATLAB Script node

    I am having some problems that seem to be a bug that I can not understand how to solve using strings in the MATLAB script node.

    I have two subVIs that make some calculations and both include a variable called "errortext" is a string. The two subVIs do their calculations using the MATLAB script node, so all the outputs are defined in the script node.

    The first sub - VI outputs that string and a number. The string is sent to an indicator on the front panel. The number is sent to the second Subvi which performs some calculations more and then returns another string of the same name to an indicator on the front panel. This second string is different from the first (error different two messages should appear).

    I did have problems with this in the past until this morning. This morning, it seems that two of these channels are now somehow mystically connected to each other. The second string repeat that what the first channel said despite the fact that the first string is not be linked to the Subvi where lives the second string. The only link between the two is a calculated value of double which went from #1 to the Subvi #2 Subvi.

    I tried many things: I tried to rename the strings so that they do not have the same name. Initially, he would not let me and gave me an error saying that the renowned string was a undefined variable (which is ridiculous). After removing and replacing things, I finally managed to do so I would change the name, but now it displays nothing at all and even more I think it might still display a completely different another string in my code!

    I also tried to remove the channel indicator and replace it. Yet once, it wouldn't let me initially. I would like to highlight, press DELETE and nothing. Finally after replacing all the subVIs with them, I was able to remove the flags, but this did not help the problem.

    Any idea for these problems pecular is greatly appreciated!

    I totally understand what you did, you were talking about variables in your fist post, and it was not clear if you were referring to a variable you have defined in the Matlab code, or you try to call a variable indicator/control, where is often seen on this forum (and who isn't). That said, the crux of The Matlab Script communicates with Matlab via ActiveX, and when you use a command window opens small. This is the workspace of Matlab environment. A variable that you define in a Matlab Script node will be visible in the other, even if it's in another VI (see attached for an example, figure). This is because the script nodes are running in the same environment space. It seems to me that if this is what is happening.

  • Using a neural network with box Toolbox MATLAB in LabView?

    I would like to know how to train a neural network in Matlab and use it in Labview? I know I should be using the MathScript, but as I do once the network formed in matlab is a dull file?

    Hi GringoButzlaff1,

    Well, it's not all MATLAB code/script that can run in LabVIEW using MathScript.

    If there is a function of IP (intellectual property) in the code, that is, any Toolbox MATLAB functions, you won't be able to execute it using the MathScript.

    In fact, you must call the MATLAB script node in your code. This node calls the script software MATLAB server to run scripts written in MATLAB language syntax and are only available for windows.

    Try encoding using the MATLAB script node and tell me if it worked for you.

    Best regards.

  • error 1050 with matlab script

    Hi, i ' v built a vi what sampling record and playback of audio files, I also added matlab script for data analysis.

    the script tested in matlab and matlab works great, when im trying to use it in labview, I get an error when running sciprt matlab. "Error with the help of griddedInterpolant... »

    I think the error takes place whe trying to run the command: "Sigitp = interp1 (clptv, clpsig, tv,"linear")"; "."

    Furthermore, I can not understand how to read the saved filed when the loop is complete.

    I don't know what the problem is.

    The vi are:

    I have also included the vi

    found how to get this working, the problem was with entry to the matlab script.

  • Using the table as a MATLAB script for entry into a Subvi - labview crashes

    Hello

    I have problems in creating a Subvi, which includes a matlab file that has a table as input.

    I created a VI, who runs a simple matlab script, with a table as an input and a table as output. It worked well, until I assigned the terminals in order to to use as a Subvi.

    After that the terminals have been assigned, labview crashes instantly when you run the file.

    I also created a VI to test the Subvi, but I couldn't make it work at all, labview always crashed...

    Does anyone know a solution to my problem? They only thing I can think is to not use it as a Subvi, but then my master file will get huge as all the matlab code would be in there...

    attached are two files, so that you can better understand my problem. (test_... is the main file)

    any help will be greatly appreciated!

    -Jarno

    Edit: I'm using labview in 2013 with windows 7 and matlab 2014

    Hey, Jarno,.

    This is indeed a bug, unfortunately. Currently followed by using identification number of the 446431 cause. The question arise when moving from an array of doubles in the Script node. The only 'solution' at the present time is to use an array of singles instead. We are currently looking to identify a fix.

  • Use of Matlab in Labview script

    Hello

    I am using matlab script in labview to post process the signals sampled data acquisition (attached is the vi I tried)

    After every 10 seconds I want to send it the voltage sampling data matlab scritp block that makes 1) detection of peaks using the peakdetection function and the peaks obtained on the sampled signal plots 2) standard of 10 dry data and locations on the chart calculates.

    But I'm confused 1) how to call the peakdetection function in the matlabscript block

    (2) how to send data 10secs of the values of voltage and time for the matlab script block

    (3) how trace signal peaks and detected on the same plot (which can be done in matlab help one, as shown in the attached vi).

    Can anyone suggest to implement these.

    Thank you.

    Hi GovRi,

    I just incorporated peakdet the script node, and it works for me. Go ahead and try again. Also, I did try it a first stab at acquiring data call. The Matlab window should open as soon as you open the vi, if it's not there is a problem with the Matlab COM connection.

    Good luck!

  • Help! How can I call the Matlab file with toolbox (matlab 7.1) in labview 8.6?

    Hello

    I developed a file matlab to optimize a system, it's Toolbox. Entries should be in Labview but also the outputs should be included in the labview graph.  The results include arrays. CVI is not installed. My labview is version 8.6. MATLAB is version 7.1.

    (1) is the version of labview and matlab questions in this problem?

    (2) what is the best solution? Matlab script? DLL? Active X?

    (3) if I could use matlab script, I define the type of each variables in labview, including those of the code?

    Thank you!

    Jessie

    Step 1: Learn patience. This forum provides no immediate technical assistance. It is composed mainly of volunteers, and most of us have full-time jobs.

    (1) is the version of labview and matlab questions in this problem?

    Not really.

    (2) what is the best solution? Matlab script? DLL? Active X?

    Any of these will work. If you want to use the script, then you must use the Matlab Script node. This allows you to enter the Matlab code directly in the node, or you can call scripts that you have on your file system. This method requires that you have MATLAB hand whole on the target computer. If you create a DLL Matlab, then you use the node library function call and call the DLL as any other DLL. This method simply requires that you have the Matlab Runtime on the target computer.  I assume when you say that you're referring to writing your own ActiveX ActiveX component?

    (3) if I could use matlab script, I define the type of each variables in labview, including those of the code?

    I don't know what you mean by defining each variable type. You need to create the entries and exits on the Script node Matlab, so you can pass data between LabVIEW and Matlab environment. The help of LabVIEW contains more information on the use of the Matlab Script node. There are also some examples with LabVIEW.

  • 2012 LabVIEW and Matlab script server error

    I just installed LV 2012 and upgrade the code that runs Matlab scripts. Now when I run it, it gives me an error of server script (1047). I'm using Matlab 2007. Someone at - it the same problem? Anyone know of a solution?

    I guess it has to do with the server script does not properly. But I can't exactly run the same code in LV 2011 without problem while LV 2012 gives me an error. Same computer, etc.

    Thanks in advance for any help you might be able to provide.

    Thank you "transfererror", this helped me identify workaround.

    For those who struggle with this, that's what I learned:

    1. This affects only the variables that are passed in a sub - VI in the connector pane (that is, local variables are not connected to the connector pane apparently do not have this problem).

    2. it seems to only affect as vectors 1 d or 2D paintings. The reason why the screws inserted by Sev_K example applies to this problem is that the types of data that are not arrays do not have this problem.

    3. Thus, to solve my problem, I inserted just an addition of 0 to all vectors and matrices that have been passed in the Sub - VI. I guess what it doesn't copy the variable in a local buffer and it is perhaps the reason why he fix it?

    In any case, workaround seems to work. I don't know what it costs in terms of speed or memory, but I do not have much about it for my application (some real-time applications that use Matlab scripts eventually consider it).

    Perhaps this information can help identify and fix this bug.

    Unique

  • labview MATLAB script prevents the execution of several times.

    I have a code for communication series in matlab, I want to use in labview for graphical interface easier and better design. for this I used the matlab script node in labview. It seems that labview continue executing the script of matlab, but I want to labview to execute only once.is he sort of to do?

    I don't see how that can occur if you run the VI in "continuous" mode

  • Spend the MATLAB data types 'cell' between MATLAB script nodes in LabView?

    Hi all

    I need to pass a variable of data type of cell of a MATLAB script node in LabView to another, but the cell is not listed as a data type 'exit' in the script node.

    Is it possible to do without converting them into a 2D array?  Each column of my cell has a different number of lines...

    Thank you!

    Mike

    Too bad...

    Rather than use a typical LabView, I just say

    assignin ('basic', ' varname', varvalue ");

    in the first script and varname called from the second node to get my cell.

    Easy... duh leaving here if anyone has the same issue in the future.

  • Running MatLab script

    Hi guys!

    I use TestStand to connect a bunch of data and save them as binary files. When the test is finished, I would like to start a matlab script. For the moment I do it manually, just open MatLab and change the path used by the script to find the particular set of binaries to test.

    What I understand you can use MathScript with the basic package.

    I requires nothing more of Matlab open / running a script in the background at a time given in the test. Could it be done by using a system call and just passing the path as a parameter to a LabView VI?

    Any IDE for what is the best approach?

    Thank you for your time!

    Ah, I understand now. Yes, the basic edition doesn't have the Matlab script node. In this case, you can use Exec System to simply call the Matlab command line. Matlab documentation contains various switches to it.

  • MatLab Script can work in multi-cores?

    Whe LabVIEW going through a 'Matlab Script' Matlab code, the part "Matlab Script" works in a single-threaded or multithreaded mode? It uses the ActiveX to communicate with Matlab, so I guess that's the only thread?

    I have a LabVIEW code that needs to call a ".m" file. I wonder if the execution of the program will be greatly improved if I convert the file ".m" in a .dll file to eliminate the need to activate the server Matlab a lot of time.

    You are right in your assumption that the MATLAB Script nodes are running single-threaded. A single script will be able to run at a time.

    You may be able to improve performance to build in a DLL, but you should test on your machine to know how much. I have not really thing this would be too great. A building in separate maybe dll code you can also improve performance by allowing for parallelism, you could call DLLs separated in different threads, I think.

    Another option would be to use the MathScript node - which allows for parallelization.

    MATLAB® is a registered trademark of The MathWorks, Inc.

  • MATLAB script node error: 1046

    Hello world

    I now use Labview for data acquisition and want to use MATLAB
    function of node script to do the work of image processing.

    I have some problems get MATLAB script to function properly. The
    It is:

    Whenever I tried to run the program, Labview gave me the following
    error:

    "Error 1046: Labview does not initialize the script server, make sure that the server software is.
    installed. »

    However, MATLAB is installed in the PC. I think that the reason of
    This error is that I'm using a PC based campus University. I got into this PC MATLAB is a network
    versioned. (i.e.
    installed on the network server, but not in the local hard disk).

    Is that what I can do to work around this error?

    Kind regards
    Kent

    Hi hykwei,

    Unfortunately, it is not possible to obtain the MATLAB Script nodes to work
    LabVIEW under your current network configuration. So that the
    Node MATLAB Script to work properly, it takes that MATLAB is
    installed on the same machine as LabVIEW. This means that you will need
    either install MATLAB on the local computer on which you apply
    LabVIEW or you need install and use LabVIEW in the same
    Server computer where MATLAB is installed. Function of MATLAB
    feature, you may be able to make some sort of minimum installation on the
    local machine that adds MATLAB to your registry and program files list,
    but who sends you right to the copy of MATLAB on the network.
    However, I am not aware if it is still an option or how you could go
    on the implementation of this scheme, so if you are interested, I would contact with
    MATLAB for more on this topic.

    Kind regards

  • Myrio and Matlab script

    Hello

    I control my physical robot with labview and my rio. I also have a matlab (m.file) code that uses it the Robotics Toolbox in Matlab. I would like to add this m.file to my labview program. Can I create a matlab script in the program labview and matlab code inside and deploy code to myrio? It will work in this case?

    AFAIK, the nodes in script call script software MATLAB server to run scripts written in MATLAB language syntax. But I don't know about adding my rio to the loop.

    Thanks for the reply.

    I also later get to know that this can be done by establishing communication between Matlab and myrio wifi.

  • Output of a Matlab script

    Hello everyone

    I work on a project for school and had a question regarding the output of a Matlab Script node. I have data that is stored in the form T(:,:,i) is 3D data which are calculated in the script.

    The main thing I want to do is output, so I can graph on a façade of Labview. I want to display an image in 2d with a third dimension represented as points on the 2d image. (2d space with the 3rd dimension in temperature).

    It would not make sense why I am doing this in Labview but I have a set built for Labview GUI and it is an extract of things I want to show. I included a file for special graphics, I am trying to show in the end.

    I'm sorry I am still learning the ropes of Labview.

    Hi Jakeyboy1,

    Here is a link that shows how to send a table to 3 dimensions of LabVIEW, but you should be able to easily change the schema in the article to go through the process.  In the article, the first table of auto-index 3D of the sample code to assign a T(:,:,i) within the script environment.  LabVIEW then uses another script node to deal with 3-Dimensional table built.

    You can enable this process.  Off the first script thread knot out the length of the 3rd dimension and which feed the Terminal N of a loop for.  In the place the script node loop that reads T(:,:,i) and outputs the 2D from the node table.  You can plug this on loop for and autoindexing should create the 3D chart in LabVIEW.  From terminal N is the length of the 3rd dimension.  The table resulting in LabVIEW must be identical.

    Send pictures to N dimensions in a MATLAB® Script node

Maybe you are looking for