Using Labview VI as a Matlab function.

Hi,
I'm trying to use Labview VIs in a Matlab script. The VI should act as a function with input and output arguments. Tried to compile the VI to a .DLL file, however was unable to read the file using Matlab.
Any advise?

What errors did you get? Can you access the DLL from some other application that uses DLLs (i.e. Excel)? Try creating a very simple DLL that just adds two numbers together, does that work?
Mike...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

Similar Messages

  • Logging data in a file using Labview VIs vs. Mathscript functions.

    Hello,
     I'm working on a data logger at 200 Hz frequency. I wanted to log the data to a file after eace sample received. When I used (fopen,fprintf,....) on Mathscript, the Labview started to log the data at a slower rate. I then used the Labview file VIs and it is working fine up till now.
    My questions are as follows:
    1- Are the file functions in the Mathscript slower than the Labview VIs ?
    2- Is saving the data to a file after each sample is received a good idea or is there a better idea ? I just don't want to keep the data in the memory and after all the data is logged, I flush them to a file ... because, it seems that the PC will run out of memory.
    Thank you,
     Walid

    wfarid wrote:
    Hello,
     I'm working on a data logger at 200 Hz frequency. I wanted to log the data to a file after eace sample received. When I used (fopen,fprintf,....) on Mathscript, the Labview started to log the data at a slower rate. I then used the Labview file VIs and it is working fine up till now.
    My questions are as follows:
    1- Are the file functions in the Mathscript slower than the Labview VIs ?
    Yes. That's because you're going through another layer of software. Why were you trying to use MathScript to log data to file in the first place? Are you a Matlab "aficionado"? 
    2- Is saving the data to a file after each sample is received a good idea or is there a better idea ? I just don't want to keep the data in the memory and after all the data is logged, I flush them to a file ... because, it seems that the PC will run out of memory.
    It doesn't make sense to save data after each sample. File I/O is an expensive operation in terms of time, and you have the operating system to deal with, so while you may be able to keep up the rate for some time, eventually it will be thrown off. You can do as suggested which is to wait until you have a certain amount and then write that to file, or you can set up a producer-consumer or master-slave architecture. Let one process/loop collect the data and put into a buffer, like a queue, and the other process/loop can stream it to disk at a more reasonable rate. You just have to make sure the buffer is large enough so that if the file I/O gets hung up you won't reach the buffer's limit.

  • How to use Labview to achieve the Autofocus function of Thorlabs DCC1645C Camera

    I have a microscope which is connected with computer, and I got a Thorlabs DCC1645C Camera to do research. I want to program labview to achieve autofocus function, which could automatically tune the hight of stage if the microscope is out of focus. Could anyone give me some help? Thanks!

    What does the manual say about computer control of this camera?

  • How matlab function is work in labview

    hi all
    i have implenet a function say
    function [op]=myimplement(ip) in Matlab
    & i have used it in simulink as Matlab function
    as i have attached the both matlab file name & also Simulink file
    i want to convert the matlab function int Labview
    i have tried by using Matlab script node
    but its is not working ??
    so where iam doing any mistake??
    iam also attaching Labview file as well name funct.vi
    waiting for any kind replay
    thnaks
    Attachments:
    prog.zip ‏10 KB
    funct.vi ‏13 KB

    As it is the Matlab node can't really do anything with that. It would be no different than if you have a .m file. You need to call the function. The Matlab node does not do that automatically (and neither does the Matlab editor). Of course, it's probably simpler to just remove the "function" line and have the last line changed to say
    uk=[x_ukp1;x_ykp1;x_zkp1;thetakp1(];
    instead of
    op=[x_ukp1;x_ykp1;x_zkp1;thetakp1(];
    Note: I believe your input variable should be "ip", not "n", since you calculate "n" in the script.

  • 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

  • How user define matlab function will work in labview

    Hi all
    iam trying to implenet the matlab function which i have wrote in Matlab 7.9(R2009b)
     function [ op ] = myimplement( ip )
     the file is attached below
    i want to use  matlab function in labview ,i have tried Matlab script node but few of function define in matlab function are not working properly
    so is any alternative way to implement matlab function in labview environment to implement my algorithm & getting same results
    thnaks
    waiting for kind reply
    iam trying from many days but not geting any results
    Attachments:
    myimplement.zip ‏2 KB

    Hi smercurio_fc nd sry if u mind my double post actually iamin last month of my post graduate research so i want to complete it urgently
    iam attaching detail file what iam facing?/
    same thing iam doing in Matlab & getting result but while doing in Labview by using Matlab script node not getting
    error 1048 is occured
    iam attaching word file kindly help me out regarding that problem
    i will be thankfull for u
    tc
    Attachments:
    my matlab function.docx ‏134 KB
    my matlab function.doc ‏154 KB

  • 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 

  • Some problems using some Matlab functions

    Hello,
    I have some trouble with MathScript when i want to use some MATLAB functions in it such as unique or histc. (i'm using windows 7 and LV2010 SP1)
    These functions are theoretically supported by MathScript insofar as they exist in MathScript Documentation but they return an error. This error explains that my matrix sizes are invalid but when we are doing exactly the same process with the same matrix in MATLAB, it ends well.
    So I checked the two MATLAB and MathScript documentations in order to see if there is a difference between the same functions. It is proving to be the same functionning in MathScript and in MATLAB so I am a little lost.
    In order to show you a concrete example :
    If we have a X matrix equals to (77 77; 88 96) and we are doing unique(X). The result is supposed to be (77 88 96) but mathscript returns an error.
    On the other hand, if X is not a matrix but a vector, unique ends well but i'm not interested in using some vectors (because it is exactly the same kind of problem with some others functions using only matrix).
    I could use a matlab node script but in this project, we would to avoid the use of a Matlab Licence.
    Do you have some idea in order to fix this kind of problem
    Thanks a lot

    Hi,
    Currently, the unique(X) in MathScript can accept vector input only. It reports error when X is a matrix. As a workaround, you can use
    unique(X(:))
    instead.

  • How to implement a callback function using LabView's Call Library Function Node?

    I am trying to call a fuction from a SDK.dll library using the Call Library Function Node. The SDK was provided to
    me and I do not have the source code, just the .dll and .h files.
    The SdkSetPropertyEventHandler function has a callback fuction as one of its parameters. How do I implement the
    callback using the CLF node? I am a good LabView programmer but this is my first time using the Call Library
    Function Node. I have read all the info I can find on NI's web site and the discussion board but cannot figure
    this one out. I am using LabView 8.6.
    The SDK.h deacribes the function as:
    //  Function:   SdkSetPropertyEventHandler
    SdkError SDKAPI SdkSetPropertyEventHandler(
                SdkCameraRef                    inCameraRef,
                SdkPropertyEvent                inEvnet,          
                SdkPropertyEventHandler         inPropertyEventHandler,
                SdkVoid*                        inContext );
    //  Description:
    //       Registers a callback function for receiving status
    //          change notification events for property states on a camera.
    //  Parameters:
    //       In:    inCameraRef - Designate the camera object.
    //              inEvent - Designate one or all events to be supplemented.
    //              inPropertyEventHandler - Designate the pointer to the callback
    //                      function for receiving property-related camera events.
    //              inContext - Designate application information to be passed by
    //                      means of the callback function. Any data needed for
    //                      your application can be passed.
    //      Out:    None
    //  Returns:    Any of the sdk errors.
    A separate header file called SDKTypes.h contains the following data:
    typedef  SdkUInt32  SdkPropertyEvent;
    typedef  SdkUInt32  SdkPropertyID;
    typedef  void       SdkVoid;
    typedef  struct __SdkObject*    SdkBaseRef;
    typedef  SdkBaseRef    SdkCameraRef;
     SdkPropertyEventHandler
    typedef SdkError ( SDKCALLBACK *SdkPropertyEventHandler )(
                        SdkPropertyEvent        inEvent,
                        SdkPropertyID           inPropertyID,
                        SdkUInt32               inParam,
                        SdkVoid *               inContext );
    Thanks for your help.
    Alejandro
    Solved!
    Go to Solution.

    alejandroandreatta wrote:
    I am trying to call a fuction from a SDK.dll library using the Call Library Function Node. The SDK was provided to
    me and I do not have the source code, just the .dll and .h files.
    The SdkSetPropertyEventHandler function has a callback fuction as one of its parameters. How do I implement the
    callback using the CLF node? I am a good LabView programmer but this is my first time using the Call Library
    Function Node. I have read all the info I can find on NI's web site and the discussion board but cannot figure
    this one out. I am using LabView 8.6.
    Basically you do not do that. LabVIEW does not know pointers and certainly not function pointers. What you should do instead is writing a C DLL that implements the callback and also exports a function to be called by LabVIEW that translates between the callback and a LabVIEW user event. Look for PostLVUserEvent() here on the NI site to find examples how to do that.
    Rolf Kalbermatter
    Message Edited by rolfk on 02-11-2009 08:00 PM
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Using LabView (Output to file function) to retrieve GPS RMC data

    Hello Everyone,
    I was wondering if anyone knows the process of getting the RMC data from a GPS unit into a labview file.
    I already have it being processed by the program, and now I need to acquire the data and put it into a file where I can analyze it. The tricky part for me is getting it into a file (speed, directional properties, latitude and longitude) and organised so that I can shove it into excel and do my calculations there.
    If anyone has any tips or answers, it would be greatly appreciated :-)
    - Luke

    If you can interface to the GPS unit, it should not be problem to write data to a ASCII file. Are you using a RS232 link then communication with your GPS?
    Then the data is in the computer you have several options for parsing the string. A RMC data may lock something like this $GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A The first thing to do is to create an array of strings using the
     "Spreadsheet String To Array Function" and "," as the delimiter
    EDIT: Take a look here also http://www.gpsinformation.org/dale/nmea.htm#RMC
    Message Edited by Coq rouge on 06-03-2009 06:05 PM
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • Can I call a User-Defined Mathscript Function using LabVIEW 7.1?

    I am trying to use a User-Defined function call in a mathscript node using LabVIEW 7.1 and I cannot seem to make it work.
    For example, consider that my mathscript node contains:
    clear all;
    close all;
    x = linspace(1,100,5);
    y = mltp(x);
    where the labview vi is saved in the same folder as the mathlab script mltp.m that is given by:
    function out1 = mltp(in1)
    out1 = 5*in1;
    Creating an array output of the mathscript node for y yields an empty array.
    How can I use User-Defined functions in a mathscript node using LabVIEW 7.1?

    Hello,
    LabVIEW 8.2 did not yet have the MathScript page in Tools >> Options.  In this version, you need to set the search path through the MathScript Window.  Launch the window from Tools >> MathScript Window.  Then go to File >> MathScript Preferences.  It sounds like you have done this.
    A first guess is that your .m file calls some unsupported functions or uses unsupported syntax.  If that were the case, you could put the script in the Script Editor of the MathScript Window and select the "Save and Compile Script" menu item.  This will return any errors from compiling the script.  However, you said you simplified the problem to a single multiplication.  Since this still does not work, I need more information.  What are all the directories listed for the path in the MathScript Preferences dialog from the MathScript window?  What is the working directory?  Where is your .m file located on disk?  Can you attach your .m file or paste the contents in your message?
    Grant M.
    Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments

  • Calling MSP430 functions in MSP430-TI.dll using Labview

    Hi
    I have few questions about implementing the MSP430-TI.dll functions in LabVIEW and I greatly appreciate your help
    I would like to read MCU through JTAG and then update the firmware
    1- I can see all the dll functions in LabVIEW but I couldn't find any documentation for these functions like what are the parameters and return values. Could you please let me know from where I can find the user guide for these functions
    2- Can I use MSP430 Flasher command lines instead of using the dll in LabVIEW
    3- I don't have the updated firmware but one my boards has the MCU updated. When I use FETPro-430 , can I click on Read-Copy and then save the txt file and use it to update the FW of the other boards?
    Thanks

    I'm looking into this issue too. TI provided an executable with graphic user interface for loading firmware, I'm thinking whether I can use LabVIEW to automate the process, it will be appreciated if anyone with this experience can provide some suggestions. 

  • Can I use LabVIEW to load data directly into system memory? The serial card I'm using isn't supported by NI nor does VISA recognize it. I'm using a Win32 function to read the data from the card and now I want it to go directly to system memory.

    Can I use LabVIEW to load data directly into system memory from a VI? The serial card I'm using isn't supported by NI nor does VISA recognize it. I'm using a Call Library function to read the data from the card and now I want it to go directly to system memory.
    The data is being received at 1Mbps.
    Thanks

    Two questions:
    One, if it's a serial card, then presumably it gives you more serial ports, like COM3, COM4, etc. If so, VISA would see the COM ports, and not the card directly. The drivers for the card should make it so that you see the extra serial ports from the OS. If you don't see the extra COM ports from VISA, then it sounds like the drivers for the card are not installed properly. Do the extra COM ports show up in Device Manager?
    Two, you said that you're using a Call Library function to get the data and you want to put it into system memory. Errr.... you just read the data and you have it in memory by definition. Are you saying you need a way to parse the data so it shows up on a graph or something?

  • Is there any one knows how to use labview 6.0 to make a "continue" function like the one in C language?

    I am using labview 6.0 and i like to know is there any one knows how to stop the current iteration in while loop or for loop and continue to do the next iteration,just like the "continue" statement in C or C++ language?

    Simple test here in LV6 confims that you can't do this. Not in a useful
    sense anyway. "Stop" doesn't stop execution simply of the current VI, it
    also kills all VIs above it. It would hence be difficult to argue that this
    approach is in any way similar to "continue".
    What version of Labview have you tested this on and can you post a
    demonstration?
    Craig Graham
    Physicist/Labview Programmer
    Lancaster University, UK
    "Oleg" wrote in message
    news:506500000005000000E45B0000-1011517314000@exch​ange.ni.com...
    > Hi,
    > you can orginize all the inner actions of your while loop into the
    > SubVI. Then use the Functios/Application Control/Stop.vi in this SubVI
    > to stop the current interation in any point you want. This will stop
    > your SubVI and yo
    u will automatically goto the next iteration in your
    > while loop.

  • Mathscript all matlab functions are not working

    Hello,
                 I am using mathscript node in my labview development. I have used right away "imfill" function to fill the holes in my edge detected image. But the "imfill" function is not working in mathscript.
    How could I use this function in mathscript?
    Attachments:
    Candel.vi ‏96 KB

    Did you take this code directly from MATLAB and put it in the MathScript node? (I'm guessing the imfill function is a MATLAB function?)
    If so, you're going to be sorely dissapointed.  While MATLAB and the MathScript node both use .m files, they are not the same language.  The language is very similar, but the syntax differs slightly in some cases.  My guess (since I've used MATLAB but never the imfill function) is that the imfill function is part of a toolkit for MATLAB.  Unless the MathScript node has a corresponding function (you'd have to search the help to see) you will not be able to use this function in the MathScript node.
    If the MathScript node has no corresponding function and you must use this function in LabVIEW, I would reccommend the MATLAB Script Node.  This structure actually calls MATLAB through the ActiveX interface.  This means that you must have MATLAB installed on the computer you are running your VI on.
    Chris
    Certified LabVIEW Architect
    Certified TestStand Architect

Maybe you are looking for

  • Problem finding components

    I can't seem to find this Integrated circuit XR2206. Is their a way for me to download this chip, or any other chip that I'm looking for. Like a 565 (PWM), 1496P etc. Please help me or point me in the right direction. I'm trying to build circuits to

  • Originals and Modified files suddenly changed to alias

    I've just been doing business as usual. Last thing I did was import several photos last week. Today, I open up the library and find that the original files have all been magically changed to alias. I could work with them up to a point, could even ope

  • Time Machine Disaster

    A friend of mine, who I have been trying to get to switch from Windows to Mac for a long time, took the plunge and bought a new MacBook Pro. He is NOT familiar with navigating MacOS. He booted up his new MBP, registered his computer and then plugged

  • How to copy songs that's already in the ipod into the computer hard disk?

    I had some "music" mp3 files, so I put them into my ipod by using iTune. I pick a mp3 file and I drop it into the "MUSIC" section under the "iPOD" section, in iTune. After this, I didn't make any backup, for exemple, place them into the iTUNE's "MUSI

  • V$nls_parameters

    Does anyone knows how to change the character set in v$nls_parameters? Eg NLS_LANGUAGE AMERICAN NLS_TERRITORY AMERICA NLS_CURRENCY $ NLS_ISO_CURRENCY AMERICA NLS_NUMERIC_CHARACTERS ., NLS_CALENDAR GREGORIAN NLS_DATE_FORMAT DD-MON-RR NLS_DATE_LANGUAGE