Using Matlab code in LabVIEW

Hi,
I have never used LabVIEW and I am wondering if there is a way to run Matlab code in LabVIEW. If so, how would I do it and are there any special instructions or tips I should know about?

What is your LabVIEW version?
Do you have matlab installed on your computer?
In older LabVIEW versions, you can only use the matlab script node, which requires that you have a copy of matlab installed.
In newer versions, you have two more alternatives that don't require the purchase of Matlab:
Use a mathscript node.
Use a scilab script node.
Information on mathscript: http://zone.ni.com/devzone/cda/tut/p/id/3502
Information on scilab: http://zone.ni.com/devzone/cda/epd/p/id/657
There is even a mathscript forum here: http://forums.ni.com/ni/board?board.id=MathScript
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • How to use matlab code in Labview without having MATLAB software. I tried to convert .m files into .dll files. But i could not do. Please help me out..

    Please help me out...
    Solved!
    Go to Solution.

    bombay wrote:
    Yes. It can be done. But Math script can not evaluate all functions in .m files (There are some exceptions).
    And those can perhaps easily be ported to LabVIEW/MathScript?
    It is not sufficient to disregard running your Matlab code in LabVIEW based on a few exceptions without first thoroughly evaluating the impact they have.
    If you want to stick with Matlab in your implementation, then there are other avenues than hypotethizing about the limited portability issues of using MathScript in your project?
    Br,
    /Roger

  • How to use matlab codes in a stand alone application without matlab license?

    Hi,
    I am not an expert in programming and i don't know about C++, i have a program using matlab codes and now i want to transfer it to a computer without matlab license. I've read something about using DLL, but i think i have to know C++ programming  to wrtie "WRAPPER" and add some lines to the program, now transformed in C++.
    I just would llike to know that really isn't any other way to integrate matlab for a stand-alone application? i read somethings in Matlab help about using COM (Common Object Model ) but i am not sure that labview works with it, and also about runtime engine and "mglinstaller.exe".
    my labview version is 8, matlab is 2006, and the real problem is using matlab codes in another computer without matlab license.
    Thanks
    Amir

    Hello Amir,
    There is a MatLab script node in the LabVIEW function palette (see screenshot of the help topic) but as you can see this structure is not in the "Base LabVIEW", you might need to purchase the FDS (Full Developpment System) or the PDS (Professionnal Developpment System) of LabVIEW...
    Do you know which one you have ?
    Hope this helps
    Message Edité par TiTou le 11-24-2006 06:38 PM
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"
    Attachments:
    mlab.png ‏71 KB

  • How to use matlab function with labview?

    Hello,
    I just want to use some matlab functions like floor(),ones()... in my labview code, who can tell me how to do it?
     I want to only install MCR in my PC, so MATLAB script node can not work because it need matlab installed. 
    Thanks
    Solved!
    Go to Solution.

    floor() exists on the standard labview pallet already and the ones() function would be fairly simple to reproduce. If you only need a few basic functions repost asking for direction on recreating those specific methods. However, you're right - there is not a direct way to use compiled matlab code in labview without full matlab and the math script nodes. If you're really desparate to reuse some some exisiting IP there are C++ alternatives that implement many of the same methods and syntax as matlab (http://arma.sourceforge.net/faq.html). I'm fairly sure there are other tools that attempt to translate matlab code into pure c functions, both of which can be called via a DLL from within labview: https://decibel.ni.com/content/docs/DOC-9076
    Alternatively, here is an all NI linear algebra solution: http://sine.ni.com/nips/cds/view/p/lang/en/nid/210525

  • 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

  • Calling a VB Script and Matlab code from LabVIEW GUI.

    Hi,
    Can anyone help me out in Calling a VB Script and Matlab code from LabVIEW GUI? GUI will be developed in Labview and currently we have some scripts written in VB and Matlab and we need to incorporate the same through LabVIEW. Can anyone let me know how this can be implemented? 
    Regards,
    Sharmash

    For VBScript you can call the Windows Scripting Host application using the System Exec function, or you can use IScriptControl, which is an ActiveX control. Be aware that with the IScriptControl there's a small bug. You can read more about it in this post.
    For Matlab, there's a Matlab node that you can use. You can either copy and past your Matlab script in the node, or just write a function call statement. The node simply calls Matlab. Or, you can do as suggested and use the MathScript node, which is basically an alternative to Matlab. The MatchScript node doesn't support everything that Matlab does, so you will need to check it against your script.
    Or, you can do as suggested, and rewrite it all in LabVIEW, unless you can't because these scripts are used by other applications.

  • How to populate multi-cluster arrays using matlab code?

    Hi,
    I have an array of clusters containing two 'Double' elements in each cluster. I am looking for a method to populate this array using MATLAB code. I need around 1000 clusters in the array, so populating it using the front panel is not practical. There is also some calculation involved in deciding the value in each element. If there is an example or a method to do this, please point me in the right direction.
    Thanks

    altenbach wrote:
    Can you attach a typical file so we know that the structure is? It is easy to convert from any data structure to any other data structure. You could even read it as a 1D string array and parse each line into a cluster, for example. It all depends on how the fil is arranged. You could also read the file as a flat string and chop it up into the desired structure later.
    I have attached the .vi file. I need to convert the spreadsheet to an array of clusters, thats where I'm getting stuck. (The vi is an example from help libraries)
    That is the part where I need to change so that I can use a spreadsheet.
    Attachments:
    Buffered counter.vi ‏52 KB

  • Can I use C code in labview?

    Hello, I've got a fairly complicated program I've written in C that
    requires two doubles to be passed to it and it spits out two integers
    as a result of a very detailed calculation. Is there a way to have
    labview call this C function? I've tried searching the NI.com website
    but all I could find were examples where labview was being compared to
    C in an attempt to show how they are equal. Any advice/links to
    relevant information or tutorials would be greatly appreciated.

    You have two possibilities:
    Compile your C code into a DLL and call it with "Call Library Function Node".
    Use the "Code Interface Node".
    The LabVIEW Bookshelf (under help) contains a PDF document name "Using external code in LabVIEW". It will probably answer all your questions. Good luck
    LabVIEW Champion . Do more with less code and in less time .

  • How we can import and run the matlab codes in labview using xmath script.

    hello,
    i have some GUI code in MATLAB and i want to process that codes in labview . tell me about the procedure how we can done this task.
    thanks in advance
    rachana
    Er. (Instrumentation)

    Hello,
    The title of your post asks about using Xmath script.  Is this what you intended?  You can use the Xmath script node in LabVIEW if you have MATRIXx 7.x or earlier installed.  However, the syntax is slightly different from the syntax of The MathWorks, Inc. MATLAB® software.
    In LabVIEW 8.0, we introduced LabVIEW MathScript.  The LabVIEW MathScript syntax is similar to the MATLAB language syntax.  In LabVIEW MathScript, you generally can execute scripts written in the MATLAB language syntax.  However, the MathScript engine executes the scripts, and the MathScript engine does not support some functions that the MATLAB software supports.  In order to reuse code that you have written, open the MathScript Window by going to Tools >> MathScript Window.  You can also use the MathScript node as part of a VI you are writing.  You can find the node on the Programming >> Structures palette.  You can import an existing script by right-clicking the node and selecting "Import..."  You can create inputs and outputs for the script by right-clicking on the node and selecting the appropriate option.  If you wish to call any functions you have written, put them in the MathScript search path.  By default, this is your "My Documents\LabVIEW Data" folder.  In LabVIEW 8.5, you can change the default search path for the main application instance by going to Tools >> Options.
    LabVIEW MathScript does not contain very many GUI functions at this time.  You can use the VI's front panel as your GUI, though, and interact with your program that way.  Let me know if you have other questions about moving your code or about specific functions.
    MATLAB® is a registered trademark of The MathWorks, Inc.
    Grant M.
    Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments

  • Using a driver with labview

    I want to create a GUI using labview to control a data acquisition card using a driver that was not created in labview. Could someone point me in the direction of some documentation that would give me some info on doing this.
    Thanks

    If you're using a non NI data acquisition card and the manufacturer doesn't have a LabVIEW driver, then you'll probably be using either a DLL or ActiveX interface that they provide. For interfacing to third praty DLLs, start with "Using External code in LabVIEW" that is part of the LabVIEW Bookshelf. You will need details from the manufacturer on the function calls. There are some shipping examples on ActiveX. The Invoke Node and Property Node functions on the Communication>ActiveX palette are used to access methods and properties.
    If you were to mention the make and model of the board you're using, you might find someone here with knowledge of it that would provide more details.

  • Tutorial on integrating C/C++ code into LabVIEW (6.0 through 7.0)?

    Where can I get a tutorial that will show me how to integrate C or C++ code into LabVIEW?

    I would also check the Using External Code in LabVIEW manual, found here
    Bilal Durrani
    NI
    Bilal Durrani
    NI

  • Generation of a lsb file to use a CIN in LabVIEW 7.0

    Hello,
    I am working with LabVIEW 7.0 under Windows XP to create a VI that uses a CIN in the block diagramm. Following the steps in the manual "Using External Code in LabVIEW" (2003, pages 3-15 and 3-16), I created a project in Visual C++.net, but there are problems during the build process. The error message is: "error PRJ0019: A tool returned an error code from "Performing Custom Build Step". Although myproject.dll is generated, no lsb file does.
    I created the enviromental variable CINTOOLSDIR and also replaced in the project settings $(WkspDir) by a path.
    What is wrong? Is there a different possibility to generate the lsb file?
    Thank you for your help.

    The solution is described in http://forums.ni.com/ni/board/message?board.id=170&message.id=120422
    The enviromental variable CINTOOLSDIR shouldn't be used. Instead, copy the cintools directory to c:\ and replace CINTOOLSDIR in the project settings by c:\cintools
    Thanks

  • Integrating C code into labview for ARM

    Hello,
          I wish to use the library functions written by Luminary engineers for their cortex-m3 controllers. If i wish to use these libraries written in C language in Labview, what i should do? There are large number of labraries are available in their websites. If any one has implemented these libraries in labview please write to me. 
    Nabhiraj

    I would also check the Using External Code in LabVIEW manual, found here
    Bilal Durrani
    NI
    Bilal Durrani
    NI

  • How do I troubleshoot installation/distribution of a LabVIEW .exe which processes data using Matlab when it works on some computers but not others?

    I've been given the unenviable task of troubleshooting and installing/distributing software written by a former co-worker. I've modified the LabVIEW code and built an .exe file. I've successfully installed the Labview .exe file on several computers, but it won't work on some others. What's more baffling is that I installed it successfully on one computer, uninstalled it, and tried reinstalling it with no success. In fact, it's a new error (Dr. Watson for Windows NT application error). It doesn't help that I have different versions of LabVIEW and Matlab on the target computers. Some have LabVIEW 5.1, some
    have 5.0, and some don't have it at all. Some have Matlab 5.2, some have 5.3 (R11) and some have 6.0 (R12). It's also not clear to me where the Matlab m files should be located. I'm not sure if it's a LabVIEW Runtime Engine problem, or if it's a Matlab problem. I've also wondered how LabVIEW and Matlab talk to each other. When LabVIEW calls Matlab, it seems that Matlab is running in the background. In other words, clicking on the Matlab Command Window and typing "whos" or any other command/variable doesn't work.

    Jay del Rosario wrote:
    >
    > How do I troubleshoot installation/distribution of a LabVIEW .exe
    > which processes data using Matlab when it works on some computers but
    > not others?
    Poke around zone.ni.com and
    http://digital.natinst.com/public.nsf/$$Search/ .
    Good luck, Mark

  • How to use matlab compiled DLL in Labview ?

    I have LV 8.5, and am unable to use a matlab compiled DLL in my LV code. I have tried the 'import'  command, but it does not list any functions. However, it does not show any errors during its execution. The existing solutions/responses to this question do not work either. I would also like to know of a way to deal with mxArray datatype. What is its equivalent in C (or any other high-level language) ? How do I retrieve an array that is returned from the matlab dll ?

    I'm assuming you have either Matlab installed or at the very least the Matlab Runtime, otherwise the DLL won't work. The "import" command relies on having a header file. Do you have one? You also need to make sure the DLL has been compiled so that it's compatible with LabVIEW. The most likely problem is name mangling, which also occurs when you try to compile a DLL written in C++. See this post, which contains links to useful posts.
    The mxArray datatype is a special datatype which is actually a structure. It's complicated. Your best bet is to create a C DLL that acts as an intermediary between the Matlab DLL and LabVIEW. If you are able to, you can, instead, simply call the Matlab code directly using the Matlab script node.

Maybe you are looking for

  • Good day sir. Im newbie in using SAP Crystal Report. I hope you can help me with my problem

    PROBLEM EXPLANATION Pretend that the attached excel file is a crystal report file Column A is the details to be compared. Column B is the details that i will have to use a formula in sap crystal report. as you can see cell B3 is same with the value i

  • Not able to get file from application server with read dataset

    Hi, Firstly i download a file from application server from read data set and then i sent this file as attachment. But problem is that i am able to send .jpg .bmp file but i am not able to send .pdf or .doc file so what can i do for that. ? My code is

  • Photo Booth and iSight Problems

    Hi there. I notice this topic has been covered a few times, but I have tried most of the ideas and with no luck. When I try to open photo booth is says "Photo Booth cannot open because no camera is attached or the camera is in use by another applicat

  • Podcast episode description not showing up in iTunes

    Hi I've got just an audio version of my podcast and as I wanted a bit more flexibility and statistics I started using Feedburner for the audio version. The only bad thing that I've found is that the individual episode description is just the descript

  • Deny user not sen to Internet

    I want to set the mappings file for block user not send email to Internet if user has "internet=no" attribute in LDAP. How do i block user from mappings files ?