Interface LabVIEW and matlab

Hello, I want to interface LabVIEW with MATLAB using TCP/IP for data transfer. Can anyone, please give me a step-by-step instruction to how to do this? Or else can you point out where I can get them? Thanks.
Solved!
Go to Solution.

Hi Sanchu,
As TCP/IP is such a generic protocol then you should be able to fairly easily build TCP/IP interfaces for both your LabVIEW and Matlab code and transfer data using ASCII, or variants etc depending on what sort of data you are trying to transfer. I'm not too familiar with Matlab, but on the LabVIEW end there are some very good TCP/IP server and client examples that ship with LabVIEW.
Another option that you may want to consider, and the reason I'm answering this is that I've recently done a project whereby we took some legacy Matlab code which we wanted to transpose into LabVIEW so that we could then fully automate a test system we have using TestStand. Much of it we were able to derive LabVIEW equivalent functions, but for some functions where LabVIEW didn't appear to have a suitable equivalent, or where it was simply more efficient, we simply copy and pasted the Matlab code into either in the first instance MathScript nodes (not dependant on Matlab) or Matlab script nodes (which will hopefully return to at a future date to fully transpose over to LabVIEW so that we are no longer dependant on a Matlab licence).
In both instances the relative ease of doing this was very impressive, and we were able to wrap huge amounts of Matlab code within LabVIEW with very few issues. As an idea, have you considered wrapping your Matlab functionality in this way and then keeping all the TCP/IP client and server comms within LabVIEW?
N.B. if you haven't found it search the palette for 'Matlab Script'
Best of luck,
David
David Clark
CLA | CTA
CLA Design Ltd
Hampshire, England

Similar Messages

  • Labview and Matlab inferfacing with each other

    I currently have Labview Mathscript RT Module that allows me to insert my matlab script into my labview program, but the problem I’m having now is the mathscript module isn’t able to run the Simulink file I have. Currently my matlab script runs and saves some variables, then calls the Simulink module inside of it and returns to the matlab script to continue to run, then it gives my labview program the final outputs from the matlab script.
    So my question is how should I go about editing the matlab script? Or is there a module I could download that would allow me to just call it directly from my mathscript RT module.

    The Mathscript RT node does not actually run code in MATLAB®, but simply runs m script code. If you look in the help for the Mathscript RT Module there is no function call listed to open and run Simulink®. You may be able to accomplish this task using the MATLAB® Script Node which uses ActiveX to call MATLAB® software. If you'd like to try this you can find this node under, Functions >> Mathematics >> Scripts & Formulas >>Script Nodes. 
    You can find some more information about the Model Interface Toolkit and it's new features here, https://decibel.ni.com/content/groups/product-pulse/blog/2013/10/07/adieu-labview-simulation-interfa... or on it's product page. 
    MATLAB®, and Simulink® are the registered trademarks of The MathWorks, Inc.
    Miles G.
    National Instruments
    Applications Engineer

  • 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

  • How to interface LabVIEW to Matlab?

    Hallo everyone,
    I have a function written in Matlab that does some calculations, the final result which is a number should be sent to LabVIEW to do something else. I want to know what is the best method to do this, ActiveX, TCP/IP or something else. why do I need this? because both programms were developed apart from each other, but know should be connected and it would take more time to rewrite either one in another software.
    Thanks in advance!

    Ive tried but it doesnt help. My matlab code is extremely complicated its all about fuzzy logic stuff and the labview program communicates with a microcontroller to control a pump.
    to make it simple, Ive 2 programms one in Labview and the other in Matlab, i want to give the inputs of the "matlab code" in LabVIEW, then matlab code works, then the result is delivered to Labview to do sth else. does anybody have any idea how to do this or is it even possible?
    Attachments:
    pic.jpg ‏34 KB

  • Labview and Matlab conductivity

    I am runing Matlab 6.1 release 12 and Labview 6.1, but I can't even get the example that comes with labview to run without getting errors. The errors I have gotten so far are 1048 and 1050. From NI they say these error should not occure with 6.1 but they do.

    I think their was an issue with the Matlab 6.1 ActiveX ID and LabVIEW. There is a KnowledgeBase on NIs website that talks about getting 1047 and 1050 errors running LabVIEW 6.1 and Matlab 6.x. There is a DLL attached that you must replace in order to get this to work. Here is the KnowledgeBase: http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/ce309627064a3d5686256a9c005b0a5f?OpenDocument

  • Different output of DST function in labview and matlab

    I am passing a 1D array of size 1550 as input to DST function. I have also calculated DST of same array in matlab using 'dst' function. I got approximately same answer till 1399th element but after that answers of two varies abruptly. I tried hard but I am unable to find the solution. I am attaching the data file in which it can be clearly seen that at 1530th element there is a difference of sign also.
    Attachments:
    data file1.txt ‏37 KB

    Out of curiosity, have you tried another software, like Octave? When you have two software that is different, which one is incorrect?
    Also, have you tried to use the DST function in LabVIEW directly?
    Another think to keep in mind... When you try to run a sequence for so long, small round-off errors could be cummulative and show later on the analysis. Also, it depends on how you load the data into each software. Hopefully when moving the platforms, the string conversion would not truncate the number. The best is not using string, but some kind of binary format...
    These are some ideas to check...
    Barp - Control and Simulation Group - LabVIEW R&D - National Instruments

  • Difference between LabVIEW FFT and Matlab FFT

    Does anyone know why there is an offset in the absolute levels of the results of the FFT function in LabVIEW and Matlab?
    See the attached VI for an example of my LV code.
    Also attached is the plot generated in Matlab, which seems to be offset by ~37dB.
    This was generated using the command 'plot(10*log10(abs(fft(x))))', where x is the same input array as in the VI.
    Many thanks,
    Dan
    Dan
    CLD
    Solved!
    Go to Solution.
    Attachments:
    FFT.jpg ‏60 KB
    FFT.vi ‏22 KB

    I see that you are using the FFT Spectrum VI which returns a single sided spectrum.  To convert from a two sided transform (ie FFT) to a single sided spectrum with RMS units there is a normalization of sqrt(2)/N where N is the number of points in x(t).  You can premultiply your x(t) by N/sqrt(2) and get the same results as Matlab.  Or, you could use the FFT.vi so you are comparing transform to transform instead of spectrum to transform.

  • Labview controlling Matlab

    I'm trying to get Labview 8.6 to programatically launch and run MATLAB 7.5.0.  We have routines currently written in MATLAB that interface with a third party's software to download data from some proprietary equipment.  Is there an ActiveX example or a better way to get Labview and MATLAB to talk nicely?  I've written a bare bones vi that will allow me to launch MATLAB but I keep getting an "Unexpected MATLAB operator" error when I try to use the Execute method on the MLAPP.DIMLApp Invoke Node.  I'm not even sure if this is the right approach for what I'm trying to do.
    I've searched the forums for hours and have found a couple of clues but most of the comments are to use MathScript or MATLAB Scripts and I don't think these will allow me to retain the comm functionality with the other software.  
    Ultimately, it would be nice if I could remotely launch MATLAB and run selected .m files.  I would also need to pass small amounts of data back and forth from the Labview GUI to the MATLAB back end.  Any help would be greatly appreciated!
    Larry 

    I agree, the VNC route is overkill.  What I think you should do is write a standalone LabVIEW application that reads an INI file and executes the desired M-files.  To control the program remotely over a network, simply incorporate a Remote Front Panel and webservices into theLabVIEW VI. Just go toTools --> Web Publishing Tool to add this functionality to your VI.  Also make sure that the appropriate settings are enabled in the Web Services section of Tools --> Option.  The LabVIEW help should have all the information you need to get going.
    Then what you will have is a LabVIEW executable (only LabVIEW runtime engine needs to be installed on that machine, and MatLAB of course) running on the remote machine that you can control through your web-browser on the machine you are sitting at.  Follow the links below for some more information.
    Developing Remote Front Panel LabVIEW Applications
    Web Publishing Tool Dialog Box
    Chris Bakker
    National Instruments
    Applications Engineer
    Check out LabVIEW 2009 and the New X-series DAQ!

  • Install MATLAB after LabVIEW and SIT was installed

    I have installed LabVIEW 8.2 and simulation interface toolkit in my computer.
    The problem is I have Matlab 6.1 in my computer and it is not support by SIT so I updated it to the Matlab 2006b.
    In such case I installed the Matlab after I installed the LabVIEW and the SIT. In this way I can find the NI sink or any other NI functions in MATLAB.
    Is there any way to import the SIT to MATLAB besides reinstall SIT?
    If reinstall SIT is necessry, should I just reinstall SIT or should I also reinstall any others? (I have LabVIEW RT, FPGA, Vision module in this computer)
    Thanks,
    -Alex

    Alex,
    You are missing all the files that need to be in Matlab. So, you just need to uninstall SIT and reinstall again. This should fix the location of the files and you can have SIT working again.
    If you run into problems, let me know...
    Barp - Control and Simulation Group - LabVIEW R&D - National Instruments

  • Error occur while interface labview with power and harmonic analyser

    hello,
            i done a project to test coreloss of motor. i our project we met some some trouble while interfacing labview software with navonip power and harmonic analyser through rs 232 communiation.i generate some error msg when i am using *IDHN? command to communicate with this hardware......  so i need ur technical support

    You will have to supply more info on the error(s) you encounter. Is there a command that does work as expected?
    Regards,
    André
    Using whatever version of LV the customer requires. (LV5.1-LV2012) (www.carya.nl)

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

  • Interfacing between labview and microcontroller using rs 232

    hi my task is to generate a wavefrom of certain frequency and certain duty cycle in labview and feed it to pic18f452 microcontroller and the o/p of microcontroller when connected to CRO should display the same frequency and duty cycle which was fed from labview.
    for that when i am sending decimal data from labview microcontrolle is receiving ascii data for eg 62(decimal) gives 36 and 32 respectively in microcontroller registers and when i use type cast function and convert the decimal data into ascii data and then sending it to uc it gives hex o/p so i am confused that how to solve this problem
    pls guide me
    thanks
    satish

    Double post

  • SIT and Matlab

    I am trying to generate de .dll of the sinewave model example that appears in http://www.ni.com/white-paper/11654/en. The fact is when i configure the settings of the real time workshop and i push the build button, an error window appears saying that there is not compiler installed. I have installed VS2010 express and with the mex -setup i have well localizated in the the matlab root. My versions of Labview and SIT are from 2012 and the matlab version is 2011a.I am using windows XP.
    Thanks for your help.

    natasftw wrote:
    http://digital.ni.com/public.nsf/allkb/02F5FA55FC28BDE1862578A30071F975
    While that's for 2011, I doubt they decided to remove 64-bit compatibility as they went forward seeing as 64-bit became more of a demand rather than less.  In that document, "Note  The LabVIEW Simulation Interface Toolkit does not support 64-bit versions of the MATLAB application software."
    As far as compatiblitly for 32-bit, I'd take a look at: http://digital.ni.com/public.nsf/allkb/D174674A91E5536286257428005C2426
    OP's question was regarding SIT support on 64-bit version of LabVIEW and 64-bit version of MATLAB/Simulink software itself, not the operating system.
    Document in your second link is on a completely different topic of API inter-compatibility of LabVIEW & MATLAB/Simulink/RTW (well, mostly Simulink & RTW). Here's the relevant link for 32-bit compatibility: http://digital.ni.com/public.nsf/allkb/049295038FF0EE2A86257A06006B2DAD there is no 64-bit SIT.
    Another underlying issues is that Pharlap doesn't have a 64-bit version. Simulations are eventually better run on RTOS (PXI embedded controllers) for a deterministic performance rather than PC operating systems.
    -BTC
    New Controls & Indicators made using vector graphics & animations? Click below for Pebbles UI

  • I am trying to use Labview and RP1210 compliant hardware to connect to a truck J1939 bus and receive messages.

    I am trying to use Labview and RP1210 compliant hardware to connect to a truck J1939 bus and receive messages. 
    Specifically I am attempting  to read data frames using the RP1210_READMESSAGE .   am able to configure the hardware and send a message to the J1939 bus. .    I think I have not configured something correctly.  I can use the RP1210_SENDMESSAGE and see the message I have sent on the bus using CANalyzer   When I use the RP1210_READMESSAGE   I get the timestamp from a message and the return from the function sends back the correct number of bytes (the number matches the number of bytes I sent out plus four bytes from the timestamp).  What I am having trouble with is actually receiving the data. I have had the same type of behavior from two different hardware (Vector CANcase XL and Nexiq USB Link), so I don't think the issue is vendor specific.
    Has anyone been able to make the RP1210_RECIEVEMESSAGE function work correctly?
    Thanks for any help

    Thanks
    I have already tried that.  The links are the NI RP1210 wraper. The problem I am having is using labview to interface with the RP1210 layer.  The RecieveMessage char*fpchAPIMessage this is the output which is a pointer to a cahracter array.  In this variable I can receive the timestamp of the message but not the message.  The retun showns the correct amount of bytes are aviaable (18 for a 8 byte message) but I can only get the 4 byte timestamp  I think I have to dereference this pointer to view the data.  I am not sure how to fix this. 

  • Looking for full time position using Labview and/or PLC's in Long Island NY area

    I have 13 years experience using Labview for user interface/daq applications.  I also have 20 years experience with Programmable Logic Controllers (PLC) programming for industrial machine controls.  My resume follows:
    Adam Wechsler
    111 Holbrook Rd.,Holbrook,NY 11741,(631) 981-1013 [email protected]
    Objective
    Labview programming, virtual instrumentation, industrial machine controls,
    automation, PLC, HMI, GUI, data acquisition
    Education:
    B.S. Mechanical Engineering 5/89
    Polytechnic University, Brooklyn, NY
    A.S. Engineering Science 5/86
    Suffolk Community College, Selden, NY
    (GPA 4.0 Dean's List Spring 1986)
    Experience:
    Controls Engineer 5/1994-3/2009
    Vacuum Instrument Corp., Ronkonkoma, NY
    *Program, troubleshoot, and upgrade automated Vacuum Chamber Industrial Leak Detection systems controlled by Allen Bradley PLCs in an OEM environment.
    *Debug equipment functions and programs prior to shipping, at customer's site, and by phone.
    *Integrate and install various types of peripheral equipment, barcode scanners and printers,
    *Design and develop Labview graphical user interfaces and HMI applications including recipe management and data collection for industrial machinery.
    *Write and review user manuals and installation instructions.
    Production Engineer 10/1989-5/1994
    Izumi Corporation, Yaphank, NY
    *Program, maintain, troubleshoot, and repair PLC controlled hydraulic, pneumatic, and control systems for automation in a hands-on environment.
    *Improve design for manufacturability of new products and prototypes to be urethane/injection molded.
    *Program, maintain, troubleshoot, and repair six axis hydraulic paint spraying robots.
    *Create interface between multiple PLC’s and central computer system.
    *Improved design and productivity of high volume, computer controlled, robotic molding machine by 150%.
    Consulting Projects:
    *Created Labview user interface components, and recipe management system for the testing of motion control servos.
    *Programmed Allen Bradley PLC machine logic for packaging machine for a food service supplier.
    *Created Labview to Allen Bradley PLC setpoint and monitoring interface for electric motor-starter test stand.
    *Programmed Allen Bradley PLC and PanelView operator interface terminal for cosmetic packaging assembly machine.
    *Developed Labview application for Fourier and statistical analysis of myogram biomedical data for researching the efficacy of acupuncture treatment.
    Other:
    *Attended National Instruments Labview training courses, and regularly attend local Labview Users Group meetings as a long standing member.
    *Member IEEE
    *13 years experience with Labview
    *15 years experience with vacuum chamber, mass spectrometer, and related technologies
    *20 years experience with PLC's and automated systems
    *Attended Autocad training course.
    *Willing to travel

    Will also consider contract, part time, or consultant work.

Maybe you are looking for

  • Diff  between logical and physical page ?

    hi what exactly difference between logical and physical pages? where to set page size in report designer? after seting paper size in report designer can i readjust in print dialogue box? which is will be effected? please explain

  • How to Convert OST Data to PST Data

    Please sujest me ... I accidently deleted exchange ID for pop/smtp configure for exchange server  ( for access mail by Internet ) after configuration and remove ID of exchange server ( Local Exchange ) then i found files not found in outlook because

  • Strange problem with IGS

    Dear Experts I have a strange problem with IGS My IGS server is running perfectly when I execute SIGS at my server system and also thrw Http link, and in GRC also But when I tried to execute the same tcode SIGS from internet thrw another system it is

  • ACE -- SSH probe

    Hello, We are trying to configure an SSH probe. I've tried creating a TCP port which checks for port 22, but I want to go further and get the probe to actually log on. I noticed that only HTTP probes have an option to configure credentials.  Is there

  • How to use garage band

    Garageband is a fun thingy But the only thing I know how to use is 'loops'. How do you use the other bits? And how do you make a really good thing?