Integrating matlab into labview

Is it possible to integrate (import) a matlab file which uses special toolbox ( like hmm toolkit and neural network) into LabVIEW??

When you say "one motor is connected to one matab file" - do you mean one .M file, or a MAT file ?  In other words, is it a program or data?  
The easiest way that I"ve come across to transfer data between different environments, is to write to an intermediate file.   Be sure to  write to a raw binary or text (dont use the Matlab 'save' command, that will save in MAT format, which I'm pretty sure is unreadable by LabVIEW).   There is the problem of signalling the LabVIEW program when data is available, you could handle this by having the Matlab program could write to another file to indicate that data is availalbe, and the LabVIEW program could continuously poll this file to see if a value has been written.   Then the LabVIEW program would read in the data file, and reset the signalling file.

Similar Messages

  • Integrating PuTTY into Labview

    Hi, the LabView serial port session VIs do not communicate well with my stepper motors (they do not respond to 50% of the stepper motor commands - Excitron stepper motors)   I want to create a VI that integrates the PuTTY serial port session manager into LabView so I can use PuTTY within LabView to control my motors.  Can someone help please?   I have found some mentioning of PIPES to do this but when I try to add it to my block diagram it says its unavailable - that source was from 2006 maybe there is another way now?  I am running LabView 2010 for Windows Vista and I am not allowed to download anything over the internet from here - just FYI.  Thanks Folks  EE
    Solved!
    Go to Solution.

    For some reason LabView doesnt recognize several commands for my stepper motors:
    w (wake up)
    i (display current settings)
    P (display motion profile settings)
    Q (run proiles x-y)
    It obeys the others but I really need w, P and Q to work
    PuTTY runs everything
    I am using the basic serial port control VI (given in the examples) for the LabView control
    I am using VISA
    I was hoping integrating PuTTY would be easy and I could have full control in LabView
    Perhaps I should be doing something different in LabView?  I have only been programming for 3 months - it was new to me until then

  • Integrating SLM into LabVIEW without external programmes

    Salutations,
    I'm trying to integrate the SLM(Spartial Light Modulator) into my LabVIEW VI.
    We used to this programme called the "HOLOEYE SLM Application Software 2.2 for the LC 2002" to adjust the grey level for the SLM.
    Now, I want to build up certain controls to adjust the grey level of the SLM, WITHOUT using any external programmes.
    We have tried using the example VI, which is the "Basic Serial Write and Read.vi" which is the first screenshot.
    However, when we type in the RS 232 code in the write buffer, the command wasn't executed even though the programme was running normally.
    We also tried building our own VI, which is the second screenshot, and the same thing happens.
    The SLM did not respond at all. It remains the same.
    Greatly appreciate your tips/advice/help to me.
    Thanks, and cheers!

    Are you sure a carriage return and line feed is what you need to send and not just a line feed?
    You have an IDN line, a blank line, then a command.  Are you sure the command is correct?  Try removing the IDN and the extra blank line.  Those might be interfering with your final command.  Basically you could be overloading the instrument and not allowing it to responde, or confusing it by sending an extra linefeed in there.
    Why are you reading zero bytes in the VISA read?  And you don't have any string wired to the data that is coming back from the VISA read?
    Have you tried the commands in Hyperterminal to see if they work there?
    You should also have a wait statement in the loop.  Right now you are running that loop infinitely fast.  That might be flooding the instrument with commands.

  • Problems of integrating Matlab functions in Labview

    Hi,
    Does anyone know how to completely integrate Matlab functions into Labview program without a copy of Matlab in the system when I run the entire program?
    Initially I used 'Mathscrip' node but I heard that it doesn't support Matlab toolbox.  Thus, I tried out the other option 'Matlab script' node. This node works well in implementing Matlab functions but it indeed requires Matlab installed in the system. 
    So in other words, how could I realize the full integration(as what Matlab script node achieves.)  without Matlab installed in the system?   
    Cheers,
    Nicholas 

    hi smercurio,
    So you mean that the Matlab script is no longer necessary in my case right?
    Could I just ask my colleague to compile his codes to matlab dll and I use the Call Library Function Node  instead of Matlab script to call it?
    About MCR, is it the correct source at the following link  http://www.mathworks.com/matlabcentral/fileexchange/5268 ?
    Sorry for those basic queries in Matlab as I have very little experience in it. lol... thanks a lot.
    Cheers,
    Nicholas 

  • I want to read a Matlab MAT file into labview.

    I do not have Matlab.  I have a series of *.mat files that are created by another program that I want to read into LabVIEW.  The *.mat files should contain a very long 2 dimensional array of complex numbers, with only 2 columns.  I am hoping that the *.mat format is straight forward.  I need to read this into a LabVIEW array to manipulate it.
    Has this been done?  I've found several routines that allow you to save data from LabVIEW into a *.mat file so that Matlab can read it, but I have not seen anything that goes in my direction.  Any help is appreciated.
    Mike

    Oh, yeah, that certainly makes a big difference.
    You're even luckier that I was still bored, so I whipped something together.
    See attached.
    Couple of things:
    (1) I couldn't test it for all data types so the "Parse Data" VI may need to be tweaked for some of the data types.
    (2) Your file contained multiple variables and the one matrix of complex values was a 1D array so you may need to insert a "Transpose 2D Array" function where the bundle function is for your 2D array.
    (3) A couple of the variables were character arrays but Matlab stores the individual characters as floating point numbers between 0 and 255 representing ASCII-encoded characters. These are the "XUnit" and "YUnit" arrays.
    For your reference, the MAT file format is at http://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/matfile_format.pdf
    Oh, I think I may have left breakpoints in when I saved the VI. Sorry about that. You should remove them when you run the VI so they don't become annoying.
    Message Edited by smercurio_fc on 02-09-2006 05:07 PM
    Attachments:
    Read Level 4 MAT File.zip ‏69 KB

  • Integration of C++ program into Labview

    I have written a C++ program that generates low level code to control a machine. I would like to integrate this program into Labview. I would like to know what would be the best approach to do:
    - use CIN (code interface node). Can I take a few parameters as inputs and pass a string of characters to labview? Originally the C++ program generates a text file with the comands to control the device, I guess this can be substituted by a string control/indicator that will control the GPIB device.
    - use ActiveX
    - DLLs??
    Thanks in advance for your help.

    Madrid,
    I would recommend that you stir away from CINs. If you can compile your C++ code into a DLL, then you can easily call it from LabVIEW. CINs have the disadvantage that if you change your code in anyway, you have to update the CIN node in the diagram of the VI. However if you recompile your DLL, you don't have to inform LabVIEW that you have a newer version of your DLL. If the newer DLL is in the same path that LabVIEW is searching, then it'll link to it automatically.
    ActiveX is also a good choice. It might take more development time than creating a DLL though.
    My two cents,
    Azucena

  • 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

  • Is it possible to import simulink blocks into labview

    Hi,
    I was wondering if it is possible to import the MATLAB/simulink blocks into labview. 
    thanks,
    Baran.

    Hi Baran,
    There is no way to directly import any of the programing blocks from The MathWorks, Inc. Simulink® software into LabVIEW.
    However if you wanted to use your own code that you programed using The MathWorks, Inc. Simulink® environment in LabVIEW, we do have the NI Simulation Interface Toolkit which you can use.
    <Brian A | Applications Engineering | National Instruments> 

  • Converting HP-BASIC code into Labview or Labwindows

    I need some insight on as to whether I can use all my HP-Basic code in labview or labwindows and how? Can I create dlls and call them into labview or use the code itselg in LabWindows?
    Any information will be appreciated.

    A very long time ago, there was a BASIC version of LabWindows.  You could not convert a Rocky Mountain BASIC program directly, but it was a fairly simple fit.  You could then translate that into C code automatically through LabWindows.  That was one of its selling points; you didn't have to lose all of that old BASIC code.  About 10 years ago, they decided to go with only a C version of LabWindows and renamed it LabWindows/CVI.  This change was made because most people who were converting from BASIC to C already had and supporting two languages and a translator was very expensive (cost, memory, processing power, complexity, - expensive in every way). 
    If someone has an old version, you might have an upgrade path with your old code (no, I don't have any that old).  Otherwise, you could build DLLs and call them with either LabVIEW or LabWindows/CVI.  You could also recreate the code with the newer language.
    Hope that this helps,
    Bob Young
    Bob Young - Test Engineer - Lapsed Certified LabVIEW Developer
    DISTek Integration, Inc. - NI Alliance Member
    mailto:[email protected]

  • Affichage d'une image traité par matlab sur labview

    Bonjour!!
    je veux faire un traitement d'image avec matlab et afficher les resultats sous  Labview . j'ai essayer la formula node de matlab dans la palette mathematics  mais l'affichage se fait toujours sur matlab comment je peux l'afficher sur labview ??  
    vous trouver ci-joint le programme utiliser .
    % Load jpeg files
    orgImage = imread('Pixel.jpg', 'jpg');
    figure(1); imshow(orgImage);
    % 2D FFT
    fftImage = fftshift(fft2(orgImage)); % 2d fft
    ampImage= abs(fftImage);
    figure(2); imshow(ampImage, [0 10000 ]);
    % Convolution (low-pass filtering)
    filter = fspecial('gaussian',[10 10], 4); % gaussian kernel
    filterImage = conv2(orgImage, filter); % convolution
    figure(3); imshow(filterImage, [0 250]);
    % 2D FFT of filtered image
    fftFilterImage = fftshift(fft2(filterImage));
    ampFilterImage= abs(fftFilterImage);
    figure(4); imshow(ampFilterImage, [0 10000 ]);
    Attachments:
    1335097296331.jpg ‏59 KB

    Hello aziz-be,
    You may find quicker responses in the french forum. 
    http://forums.ni.com/t5/Discussions-de-produit-de-NI/bd-p/4170
    Regarding your question.  The Matlab Scipt Node uses activeX to access an api that calls into the Matlab engine.  Thus any figure generation would occur on the Matlab side of things.  What you could try doing is converting the figure to an image, converting the image to an array, and bringing that array into labview and converting it into a LabVIEW image type which you could then display inside of LabVIEW.  This is a rather convoluted way of displaying a figure on the front panel inside of LabVIEW though.  You may find it much easier to do what you are trying to accomplish with the MathScript Node rather than the Matlab Script Node.
    figure (MathScript RT Module Function)
    http://zone.ni.com/reference/en-XX/help/373123B-01/lvtextmath/msfunc_figure/
    NI LabVIEW MathScript RT Module
    http://www.ni.com/labview/mathscript/
    David A
    National Instruments
    FlexRIO Product Support Engineer

  • Toolkit matlab avec labview

    bonjour à tous et merci d'avance ,
    je cherche un lien(ou bien une idée) pour télecharger le toolkitmatlab compatible avec labview 2011 (sinon 2009).
    l'objectif c'est que je veux transformer un code matlab vers labview.
    merci les ingénieurs du ni et tout les membres de forum.
    amicalement

    Hi khadija,
    You should be able to find the 2011 version of the mathscript-RT toolkit on ni.com/downloads. The download site has recently undergone a lot of changes and the search may not be up to speed yet. A direct link to the 2011 mathscript-RT toolkit is here: http://joule.ni.com/nidu/cds/view/p/id/2558/lang/en. 
    However, it sounds like you are using Matlab toolkits. The mathscript-RT toolkit re-compiles .m code into labview source code. However, the mathscript-RT toolkit will not work with any of the Matlab® toolkits, such as a vision processing toolkit. A list of commands the mathscript node can use is given here. 
    You also might try using the Matlab Script node, which is separate from the Mathscript-RT node, the Matlab Script node uses activex to call into the Matlab runtime engine. It should be able to utilize any toolkits that the mathscript-RT toolkit can't. However, the Matlab Script node will be slower and will require an installation of Matlab on each computer that your application runs on. 
    MATLAB® is a registered trademark of The MathWorks, Inc. Other product and company names listed are trademarks and trade names of their respective companies.
    Jesse Dennis
    Design Engineer
    Erdos Miller

  • Help with reading information coming from a software into LabVIEW through Serial port

    Hi,
    I am new to LabVIEW and also an amateur in using RS232 for communication. I have this software that has these icons like speed increase/decrease, elevation up/down, start/stop. Now, when I click these buttons on the software, they perform the appropriate functions. For example, if I press start button, the signal must go through a serial COM port into LabVIEW to start the machine. How do I do that? How do I find what format the code word is when I press a button on the software? And how to decode the information to read whether the button pushed is start etc...? Any help would be appreciated.

    I may not be perfect, but I'm all I got!

    That information would be in the programming manual for the device you're controlling. Unless you have a device that has no documentation or you cannot get the documentation that's the first place you should look. If you cannot get the documentation at all then you've got some reverse-engineering to do. To do this you will either need a serial port sniffer (a hardware device), or you can try to use a software-based port capturing program. On Windows PortMon is the most prevalent. This will show you how the port was configured (baud rate, stop bits, etc). Warning: the information is technical.
    As far as how to get it running in LabVIEW, you should take a look at the serial port communication examples that ship with LabVIEW. The most problems occur in figuring out how to (a) terminate a write command, and (b) determining when to stop reading. For (a) this is typically done by appending a carriage return or linefeed to the command. This is device dependent. For (b) this is usually done by the byte stream ending with a character like a linefeed. Again, this is device-dependent. 
    You may also want to peruse this KB article: Serial Instrument Control Tutorial. There are also lots of tutorial on the internet for basic tutorials on serial port communication.

  • How can I get an unsigned char string with nulls from a dll into LabVIEW 6i?

    The following ethernet packet data is contained in an unsigned char * string returned from my dll (it's formatted on printing):
    Received A 230 Packet On Adapter 0x008F0070
    Ethernet Dest: 01.E0.BB.00.00.15 Src: 00.E0.BB.00.DD.CC Type: 0x8868
    000000: 01 E0 BB 00 00 15 00 E0 : BB 00 DD CC 88 68 48 41 .............hHA
    000010: 00 E0 BB 00 DD CC 80 B3 : 00 00 FF FF 00 02 00 01 ................
    000020: 01 00 F0 18 FF 7F 7F FF : FF 7F 7F FF FF 7F 7F FF ................etc., etc.
    However, when I read this string into LabVIEW 6i, I only get the following:
    01E0 BB
    Which is the data before the first NULL or 00 information. I found a "Remove Unprintable Chars.vi" but it
    just sees more data before the above string, nothing after, as seen here: 5C30 31E0 BB.
    Anybody have any suggestions for how to get the rest of the string? Is there something I can do to further reformat my dll? The dll I'm using is already a wrapper around another dll so I have some flexibility, but the bottom line is, the data I want is in the format of an unsigned char *.

    Excellent advice, this mostly works so I have some further questions:
    I am just reading network traffic off my ethernet card right now, but here is what I get using my C program to test:
    000000: 01 E0 BB 00 00 15 00 E0 : BB 00 DD CC 88 68 48 41 .............hHA
    000010: 00 E0 BB 00 DD CC 80 B3 : 00 00 FF FF 00 02 00 01 ................
    000020: 01 00 38 3C FF 7F 7F 7F : 7F 7F 7F FF FF 7F 7F FF ..8<............
    000030: FF 7F 7F FF FF 7F 7F FF : 7F 7F 7F FF FF FF FF FE ................
    000040: FE FF FF FF FF 7F 7F 7F : 7F 7E 7E 7F 7F 7E 7E FF .........~~..~~.
    000050: 7F 7F 7F 7F FF 7F 7F 7F : 7F 7F 7F FF FF 7F 7E 7F ..............~.
    000060: 7F 7F 7E 7F 7F 7E 7F FF : FF 7F FF FF FE FF FF FE ..~..~..........
    000070: FF FF FF FF FF 7F 7F FF : FF 7F 7F FF FF FF FF FF ................
    000080: FF 7F 7F FF FF 7F 7F FF : FF 7F 7F FF FF 7F 7F FF ................
    000090: FF 7F 7F 7F FF 7F 7F 7F : 7F 7F 7F FF FF 7F 7F FF ................
    0000A0: FF 7F 7F 7F 7F 7E 7E 7F : 7F 7F FF FF FF FF FF FF .....~~.........
    0000B0: FF FF 7F FF FF 7F 7F FF : 7F 7F 7F FF FF 7E 7F FF .............~..
    0000C0: FF FF 7F FF FF 7F 7F FF : 7F 7F 7F FF FF 7F 7F FF ................
    0000D0: FF 7F 7F FF FF 7F 7F 7F : 7F 7F 7F FF FF FF FF FE ................
    0000E0: FE FF FF FF 00 01 : ................
    And here is what I get using LabVIEW to call the dll:
    0015 00E0 BB00 DDCC 8868 4841 00E0 BB00 DDCC 80B3 0000 FFFF 0002 0001 0100 9600 7F7F 7F7E 7F7F 7F7F 7F7F 7F7F 7F7F 7F00 B405 4300 3300 0000 0000 0000 01E0 BB00 0015 00E0 BB00 DDCC 8868 4841 00E0 BB00 DDCC 80B3 0000 FFFF 0002 0001 0100 9600 7F7F 7F7E 7F7F 7F7F 7F7F 7F7F 7F7F 7F00 F405 1B04 0C04 0000 0000 0000 8000 0000 0000 0000 0800 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
    The first thing I notice is that the first 4 bytes are chopped off, and after about 50 bytes, the data is corrupted until the sequence starts to repeat, but this time it starts with the missing 4 bytes and still corrupts after about 55 bytes.
    I am expecting the data in LabVIEW to look very similar to the C data because the network packets I am grabbing are pretty consistant, only a couple bytes will vary between them, not the number I am seeing in LabVIEW.
    Another side effect I'm seeing is that I can only run my labVIEW code once, if I try running it again it crashes with failures such as:
    memory could not be "read"
    For reference, I am opening and closing the network adapter inside the read function of my dll, but the pointer seems like it should be intact...
    Attachments:
    zListAdapters.vi ‏30 KB
    listAdapters.dll ‏201 KB
    Reading.dll ‏213 KB

  • Way to acquire more than one sample at a time into Labview from cFP?

    In reading data from my cFP into Labview I see that I can use the FP Read.vi but it only grabs one sample per call (loop iteration).  In other devices, I could just use the AI Acquire Waveform.vi to grab multiple samples per call.  Can I use this for cFP?  Is there another way to grab more than one sample per call from my cFP?  I'm just running it from a host computer, not using RT.
    My specific problem is that I have two things I want to do with the same signal, one slow (PID control loop) and one fast (data logging).  If I put the FP Read.vi in the same loop as the PID control, I can only get one sample in the time it takes the PID loop to run which is too slow.  I'm trying to think of ways around this problem.
    Thanks,
    Hosehead

    Hello Hosehead,
    With FieldPoint there is no way to acquire more than one same at a time like
    you can with NI-DAQ.  With the FieldPoint read and write VIs
    you can only read or write a single point at a time.
    Please see the Sampling
    Speed of FieldPoint Modules document for more information on cFP
    acquisition rates.  This document explains how channels are updated, how
    often the data is updated, and what happens if you miss samples.  Please
    note that you will be able to acquire more samples if you are running your
    application on the RT controller and not on your host computer.
    If this does not answer your question, can you please post more data about the rate
    you want your PID loop and your data logging loop to run at.
    Regards,
    Jesse O.
    Applications Engineering
    National Instruments
    Jesse O. | National Instruments R&D

  • MATLAB and LabVIEW Communication Optimal Performance

    I have tried my own code,  searched through forums and examples to try and figure out best method to communicate between LabVIEW and MATLAB.  Most of the information I found was over a year old and I was wondering if there was a better current solution.  My goal is to work in LabVIEW to collect the data, process in MATLAB and return the results to LabVIEW.  I have encountered some difficulty in my search and before I delve even further in to one in particular, I was wondering if anybody had an optimal solution with this communication protocol or solutions to my errors encountered thus far.
    I have looked at the following methods.
    1)TCP/IP and a very good example found here: http://www.mathworks.com/matlabcentral/fileexchange/11802-matlab-tcp-ip-code-example
    When I try to adjust even the example and communicate for my own purposes I get the following errors
    Error 63 if MATLAB server not running
    Error 66 occurs if the TCP/IP connection is closed by the peer. In this case, Windows notices that no data is returned within a reasonable time, and it closes the TCP/IP connection. When LabVIEW attempts to communicate after Windows closes the connection, error 66 is the result. 
    However, the example itself works perfectly and does not get these errors
    2)Math Script Node, works but the post below states that MATLAB Node is faster.
    "computing fft of a 1024x1024 matrix ten times (attached code). Result is that Matlab node version takes 0.5s versus 1.6s for Mathscript node version."
     http://forums.ni.com/t5/LabVIEW/Why-are-mathscript-performances-much-below-matlab-s/m-p/2369760/high...
    3) MATLAB Node, which states it uses ActiveX Technology seemingly works well, but loses time for data transfer.
    4) Trying to use the ActiveX functions or if there is other Automation potential.
    5)Other solutions that I have not found that might be better suited.
    Thank you for any help or suggestions in advance. 

    Barp and Mikeporter,
    Thank you for your assistance:
    The reason I need to do the processing in matlab is as you mentioned the processing script is coming from another person who has already developed it in matlab.  I almost have to treat it as a black box.
    The TCP/IP method was interesting is that none of the errors show up when I run the example but if I try to modify it in a new VI I get the errors.
    I have attached a simple program that just has a basic butterworth low pass filter I am trying to confirm if it works in the Matlab node.  I have done other simple codes which work, and this one does not seem the implement  the appropriate filter.  The LabVIEW signal and LabVIEW filter seem to work at the default values (but not if I change sampling rate) for the Simulation of signal, Matlab signal and Matlab filter work, but the Labview signal processed in Matlab is not working...
    Ideally it would be bandpass filtered (0.1-30) at sampling rate of 256 Hz and further processed from there, but I can't even seem to get low pass to work in the matlab to labview communication.
    Any help would be greatly appreciated.  Once I have that working I will have more of an idea of the constraints of the actual processing Matlab Code I will be using.
    Thank you again.
    -cj18
    Attachments:
    labview_matlab_filter.vi ‏70 KB

Maybe you are looking for

  • Odd Smart Mailbox Behavior

    I receive a lot of mail with attachments so I created a Smart Mailbox with the following conditions -- ALL must be met: 1. Contains Attachments 2. Date Received is not in the last 2 weeks My goal is to keep my mail intact for 2 weeks, and then delete

  • Help Please! Timeline Question with Invisible Buttons

    I am new to FLASH and have created a rotating banner for our website with 5 roatating images with 5 invisble buttons linking to 5 landing pages. And  it works the first loop through.  However when it gets to action 5 for my last image, that link cont

  • Imac 10.8.4 Audio Hardware Setup

    Dear all I am trying to connect an external mic (AKG  C 2000 B) to the new imac 2013 with osx 10.8.4 I have: 1. XLR cable. 2. Apple Fire wire to thunderbolt adapter. 3. 400 to 800 Fire wire cable. 4. M audio Firewire 410 (no drivers for 10.8.4). 5. M

  • Icons rearrange move after resetting / rebooting

    Every single time i reboot / reset my phone my icons rearrange / change order! how can i stop my phone from doing that? the older version OS didn't do that....it takes so much time to rearrange everytime i reboot, i am using the BB today plus theme .

  • Runtime Errors         OBJECTS_OBJREF_NOT_ASSIGNED

    Runtime Errors         OBJECTS_OBJREF_NOT_ASSIGNED Except.                CX_SY_REF_IS_INITIAL Date and Time          24.09.2007 11:27:19 Short dump has not been completely stored (too big) Short text      Access via 'NULL' object reference not possi