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.

Similar Messages

  • How to use a C# dll in Labview?

    How can I use a C# dll in Labview 8.2? With the "Import Shared Library" Wizzard I need the header file which I don't have. Is there another way
    to use such .dll to import the functions created in C#?
    Thanks in advance
                                  Norick

    Norick,
    afaik there is no tool which provides you the possibility to create something like an instrument driver for .NET assemblies.
    Maybe we should take a look into terminology:
    - Instrument driver: This is a set of functionality, which provides the user with an easy to use API for a special instrument. Very often, the driver itself is written in C/C++ and provided as a DLL.
    - "Import Shared Library" Wizard: This wizard enables the user to create an own API for any C/C++ DLL (or compatible) for LabVIEW. This wizard requires the information on all exported functions; this info is contained in the header file. The result of the wizard is a set of VIs containing one Call Library Function Node each for each exported function.
    - .NET assembly (extension .exe OR .dll): This can be compared to ActiveX. So the way to program with .NET is similar to ActiveX. Maybe you want to take a look into the examples of LabVIEW regarding .NET...
    - Global Assembly Cache (GAC): All assemblies contained here are registered in the system. Every application can easily work with assemblies contained here.
    - Private assemblies: This would be the way to work with .NET assemblies which are built on your own. You have to select the .DLL-file itself and make sure that the file can always be found in the same (relative)folder of your application.
    hope this helps,
    NorbertMessage Edited by Norbert B on 02-21-2007 02:16 AM
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • How to generate and use Matlab(R2007) .dll's in Labview

    Is there a step-by-step example on how to generate and use Matlab(R2007)  .dll's in Labview.
    Our experimenal hardware is LabView-controlled and we want to pass
    images/2d intensity arrays to a more complex matlab program that will
    return an array of extracted data which we want to use in LabView again.
    Thank you
    Carsten

    I recommend having a wrapper created around the matlab dll that converts the datatypes for you. There is a lot of fooling around with pointers involved which is very difficult in LabVIEW. btw, this got much more complicated after Matlab 7. Essentially, you need to convert your inputs into mxArrays, and then add those mxArrays to an mxArray list that you pass by pointer into the matlab dll. You also need to create a mxArray list for the outputs from the dll which you will need to extract your data out of before converting it back into a LabVIEW supported datatype. It's a big hassle. We do this pretty often, but we have created a c library that handles all the conversions, so it is feasible for us. Unfortunately, I can't share the library, but hopefully this information will help you get where you want to be.
    Like I said, it would be easier if you can just get a c developer to write a wrapper for you to keep it simple in LabVIEW. Alternatively, you might try getting your m-code to work in Mathscript.
    Chris

  • How to use third party DLL's in LabVIEW

    Hi all,
    Am using maxon EPOS 2 (Easy Positionning system) to control the EC motor. It comes with the 32-Bit Windows DLL for labVIEW. How to use these library unctions in labVIEW properly? When i try to call those library function in a LabVIEW program, it's showing me that one warning affecting one caller and so the subVI is not executable. Do i have to change the location of the library files or make to make any other changes??  
    Solved!
    Go to Solution.

    Have you seen the KB: Program a Maxon EPOS Controler using LabVIEW ?
    Christian

  • Using gpib-32.dll in Labview 7.0

    Hi there,
    I am relatively new to Labview and I need some help trying to program an old HP3488A switch/control unit using the Call Library Function Node. I would like to convert the existing VB6 code, which uses gpib-32.dll, into Labview. What I have done in the VB code is to call the ibdev function to set up the HP instrument. I would like to do the same in Labview. How would I even go about setting up the .dll files as I am revamping the existing code (running on a Pentium II computer) and trying to create an identical code in Labview (running on a Pentium III computer). Also, after I have set up the .dll files (done any system configurations if necessary), how do I actually implement this file in Labview?
    I have tried calling the ibdev function in the properties of the Call Library Function. I created 6 parameters of return types with ranges of type long. Then I pass integers into the input of this node and when I tried running it I get an error exception within the external code as follows:
    "An exception occured within the external code called by a Call Library Node. This might have corrupted Labview's memory. Save any work to a new location and restart Labview. VI "switch.vi" was stopped at Call Library Function Node 0x1D7C of subVI "switch.vi"
    Can someone please help me? Thanks.

    I actually tried that before. As the HP3488A switch instrument is very old and came out before IEEE488.2 got introduced, it still uses IEEE 488.1, or HPIB commands. When I try using MAX or even my Agilent IO Control, it shows that there is an instrument connect to GPIB address 10, but neither programs can auto-identify the instrument using the *IDN? query. Even so, I tried typing ID? in both programs and I got no data back from the instrument. I'm not too sure as to what the problem is since I always get "\n" back from the instrument's reply. I even tried changing the termination character enable to TRUE and I still got nothing back.
    However, on the front local display of the switch, I can see arrow indicators moving between TALK and LISTEN whenever I perform a write or write/read command. But no data gets sent or received because I couldn't perform any write commands to change the switch. If anyone can tell me what the real problem is that would be great. But if not, then I will have to use the Call Library Node because I know that my VB6 code actually works on the HPIB instrument and I could simply use this gpib-32.dll file on Labview and perform the same instructions, which should allow me to talk to the switch. Can anyone tell me how to properly set up a Call Library Function Node as I have errors using the gpib-32.dll file (please see my previous message)?

  • How to use Third Party DLL in Adobe Illustrator Plug In

    Hi Everyone,
    I want to design plug-in for Adobe illustrator CS6(64 bit). As first step I am referring sample plug ins from ../SDK/SampleCode. I am not getting how to use third party DLL in plug in.
    Please let me know how to refer C# DLL in illustrator plug in.
    Thanks in advance.

    There's no C# API for the Illustrator SDK, so your plugin must be C++ at the very least. That said, you can probably write a bridge if you need to call out to a C# library/DLL.

  • 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 postlv user event in labview

    Hi sir 
     I am sending data labwindow cvi dll call to labview,for that we need postlv user event.please any one knows to use postlv user evenet in labview.
    Below will  be the  structureand i need to update in labview .
    typedef struct
    unsigned
    uDSPIO,
    // uDAQMode,
    // bControllerActive,
    bShutDown,
    bPowerOn,
    bPowerHi,
    bPowerFault,
    bSGIdle,
    bSGHold,
    uBitsIn,
    uBitsOut,
    uCycleCount,
    uCycResidue,
    uBlockCount,
    uLogChannels,
    uCurrentMode,
    uAsigndPhysCh[LOG_CHANNELS];
    float
    fSetPoint,
    fDAQRate,
    fRange[LOG_CHANNELS],
    fReadout[LOG_CHANNELS],
    fMax[LOG_CHANNELS],
    fMin[LOG_CHANNELS];
    char
    sChID[LOG_CHANNELS][32],
    sChUnits[LOG_CHANNELS][16];
    CTRL_CHANNEL_STATUS;
    Attachments:
    GDSCallback.vi ‏12 KB

    AThe fixed size arrays in your structure are inlined byt the C compiler. This means they are not an array pointer (and definitely never a LabVIEW array handle) but rather LOG_CHANNELS amount of unsigned ints and floats directly embedded in the structure. In LabVIEW terms this is most easily represented as a cluster with LOG_CHANNELS elements inside the main cluster.
    So basically your uAsigndPhysCh needs to be a cluster with LOG_CHANNELS elements of unsigned ints and  fRange,  fReadout, fMax and fin are clusters with LOG_CHANNELS single precision float values, and then sChID is a cluster with 32 * LOG_CHANNELS chars and sChUnits one with 16 * LOG_CHANNELS chars.
    However I would personally rethink this strategy. This huge cluster monster is passed into PostLVUserEvent() each time and copied into the event data on every event, causing quite a bit of overhead that way. Is it really necessary to post all this data every time?
    Also you have commented out uDAQMode and bControllerActive in your C structure but included it in the LabVIEW cluster which will certainly throw off your data. Last but not least the b prefix would probably indicate that you are only using that element as a boolean value, so why not consider to use bit fields there? In LabVIEW you can easily seperate those bitfields by either translating the resulting uInt32 into a boolean array or even more efficiently use boolean logic to detect the bits.
    And in order to let LabVIEW react on a user event you have to create that user event with the correct datatype (your cluster monster) and then pass the user event refnum to your DLL. This DLL then calls PostLVUserEvent() with the user event refnum as first parameter and a pointer to a data structure that matches the LabVIEW user event datatype EXACTLY whenever it wants to post an event to LabVIEW. The user event is also registered in an event structure in LabVIEW which will then get triggered everytime your DLL posts an event by correctly calling PostLVUserEvent().
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How to use a c file in LabVIEW

    Hi All,
    I have a c file which communicates through serial port and J1850 protocol. I want to use the C file in labview and do the communication through serial port.
    Can any one give me an idea how I have to use the c file in LabVIEW.
    Thank you.!
    ---------------- Be Good. Do Good. ---------------------

    Have you tried reading the LabVIEW Help or even searching this web site? This question has been asked MANY times. There's a section in the LabVIEW Help called "Calling Code Written in Text-Based Programming Languages." There are also several articles written on this. Here's just one: https://decibel.ni.com/content/docs/DOC-1690
    Please do the research and then come back with a more specific question.

  • How To Use Exported Function "CallInstrument" of LabView.exe ?

    Hello!
    I want to use the function "CallInstrument" to dynamically call VIs with LabView. Did anyone has experiences with this function?
    All I kow is following:
    The function is used by LabView Internals and its Runtime Library. Its exported by LabView.Exe and lvrt.dll.
    Its prototype is maybe:
    int CallInstrument(CPStr* VIPath, int controlcount, int indicatorcount, int options, [ Variable List of Control/Indicator Parameters ]... );
    ( CPStr Type is a StringArray of PStr (Short PascalStrings) as it is used by LabView to store Path datatypes. )
    I whould be glad, if anyone has information about this function.

    Dear Rolf Kalbermatter,
    Thirst, thanks a lot for your answer! -
    You sure right, It whould be much much more comfortable to use the VI Server.
    And you're also right... using a undocumented dll-function is absolutly no longtime solution.
    Currently I am using VI Server for my problem, but it doesn't fit my interesst so much.
    But I will explain, what I'm trying to do.
    I want to call a VI dynamically from LabView, giving Parameters to its Controls and receive Results from its Indicators.
    Realy no big job, but VI Server only let you do this that easy if you have a VI Typedef. otherwise... with untyped VIs, its not that simple. Ok.. its not impossible, you can use "GetAllControlValues" and "SetControlValue" (functions from VI server) and the call "RunVi". But this can get slow (>100ms per call :/ )
    I'm looking for a alternative function, which let me call a VI dynamically with userdefined Parameters. Maybe you know the ActiveX Interface IVirtualInstrument and its Function "Call2" - it is a nice example, what kind of function i want.
    But this function is not directly available by the VI Server--- i don't know for what reason.
    Then i tried to make use of "Call2" from within LabView, and it took me some time to find out the right Parametersyntax but finnaly i got it and it worked fine ... but it was no long time until problems occur. I cannot tell what really went wrong, but sometimes labview simply crashed or hang into a loop reseting some VIs. And its also impossible to stop a running vi, with has made a call to "Call2", if the call doesn't return by itself.
    Next step is/was trying to take advantage of CallInstrument. So, yesterday... after hours of analysing assemblercode, i finnally found out the correct use of LabView.exe->CallInstrument and i'm very impressed about its speed (0-15ms per call). The prototype seem to be the same as you explained in your reply int CallInstrument(Path path, Bool modal, int32 nInputs, int32 nOutputs, ...)
    But It has the same problem as its ActiveX derivat "Call2".. if you call an endless looping VI, LabView cannot stop your caller-vi. The other bad thing is, that this function is using dynamic paramterlist, which are placed directly onto the stack!
    That means that the paramter count on the stack is NOT FIXED (printf makes it the same). LabVIews DLL InvokeNode doesn't support this.
    At my current position, it looks like i have three possiblities but no one fits into my interesst.
    (continued with next answer)

  • How to use a C# dll with JNI

    After a ton of issues, I finally got this working properly. I've come across a lot of forum posts about the various problems and VERY few answers so I thought I would post my solution here.
    To do this, you need to create a managed C++ layer in between C# and java. The JNI functions in C++ dll can make calls to the C# dll directly, and your java program can make calls directly to the native JNI functions. Some important notes on using C# classes in C++ are:
    -gcroot<CSClass ^> should be used on any objects that are instances of some C# class.
    -the symbol ^ should be used with all C# references (its the symbol for references)
    -gcnew should be used to allocate C# objects
    -in visual studio, add the C# dll as a reference rather than using #using <CsDLL.dll>
    -do not use #using <CsDLL.dll>
    The next issue is loading the libraries. By adding the folder your C++ dll is located in to the Djava.library.path VM argument, you can load your C++ library with System.LoadLibrary("Cppdll.dll"). You DO NOT need to load the C# dll in your java program. In fact, it will ignore you if you try. The problem with loading this dll is with how the CLR searches for referenced assemblies. The CLR First searches the DEVPATH environment variable (if the machine.config file has developer mode set to on), then it searches the GAC, then it searches the codebases, then it searchs the current executable's directory along with a list of definable subdirectories (probes).
    DEVPATH is a decent option, but it requires modifying the machine.config file to be in developer mode. Once that is done, it acts just like the PATH environment variable.
    If your C# dlls are strongly named, I would recommend adding them to the GAC or using codebases. However I have not done this and am not sure how.

    Hi,
    i have to use a c# dll in my java program .by following this link http://www.codeproject.com/KB/cross-platform/javacsharp.aspx i done that.but it is working for only one c# program.if i am trying to use a dll it is throwing error
    # An unexpected error has been detected by Java Runtime Environment:
    # Internal Error (0xe0434f4d), pid=3988, tid=3704
    # Java VM: Java HotSpot(TM) Client VM (11.0-b16 mixed mode, sharing windows-x86)
    # Problematic frame:
    # C [kernel32.dll+0x442eb]
    # An error report file with more information is saved as:
    # D:\Work\EclipseWorkspace\HelloInflux\hs_err_pid3988.log
    # If you would like to submit a bug report, please visit:
    # http://java.sun.com/webapps/bugreport/crash.jsp
    # The crash happened outside the Java Virtual Machine in native code.
    # See problematic frame for where to report the bug.
    Please help me out. i want a few steps to invoke a c# dll by using jni

  • Using a cygwin DLL in LabVIEW 7.0

    Hallöchen!
    I try to use a function from a cygwin DLL in a LabVIEW 7.0 VI. So
    I wrote
    void funcName(double values[], long number_values)
    for (int i=0; i < number_values; i++) values[i] /= 2.0;
    to the file test.cc and said (cygwin gcc 3.3.1)
    gcc -c test.cc
    gcc -shared -o hall.dll test.o
    Then I included it as a shared DLL in LabVIEW, added the correct
    parameter sequence and return value. The name of the function was
    a little bit different (Z8funcNamePdl).
    But: LabVIEW crashes every single time. Not matter what I say about
    calling convention or reentrance. As soon as the "configure" window
    is closed, *all* LabVIEW windows are closed.
    What am I doing wrong?
    Thank you!
    Tschö,
    Torsten.
    Torsten Bronger, aquisgrana, europa
    vetus

    Hallöchen!
    LarsRoe writes:
    > [...] LabVIEW arrays have a different structure than the
    > traditional C arrays. As a quick test, try passing in a single
    > DBL value by pointer for the first argument, and 1 for the second
    > argument.
    Even a "void Test()" lets LabVIEW crash. I now say
    extern "C" {
    void Test();
    void Test() {
    return;
    > The prototype in your C function needs to match the prototype you
    > get from the "Create C File..." Dialog.
    Granted, but quoting the gcc manual: "Good compilers never crash."
    I didn't *start* the VI after all.
    Tschö,
    Torsten.
    Torsten Bronger, aquisgrana, europa vetus

  • How to use XVID MEPG4 DECODER in labview

    May i ask how to use Xvid MEPG4 Decoder to compress the AVI file. For this decoder have been installed in my computer but the VI(IMAQ AVI2 Get Codec Names)can not list this code name. So may i ask how can i use this decoder in the labview. For this decoder is relatively has good quality and also small size. Or what kind of other solution can be provieded for the relative small size of AVI file.
    Thanks
    Daniel

    I believe this was answered already in a different thread:  http://forums.ni.com/t5/LabVIEW/LabView-to-grab-and-save-video-to-mpeg/m-p/643864
    www.movimed.com - Custom Imaging Solutions

  • How to use a VB dll file in java

    hi,
    i am working on college project,In this output of calculation is not matching with college site .So any one can tell "how to use or combine a VB 'dll' file in java?".so that i can use VB 'dll' file in java to get right Output.
    If possible write code or send it to "[email protected]"
    Thanks
    Ravi kapani

    Did you try Google? And no, there is no native support for accessing .dll files from Java. That said, take a look at JNI.

  • How to Use SDK compile all MXML file in project ?

    Who can teach me ? Plz
    1.How to Use Adobe SDK to compile all MXML file in project ?
    2.How to Use Ant to compile all MXML file in project ?
    Thanks everyone !!

    Thank you first!
    Yes,you are right,since I am new to illustrator,and I want to try to write a plugin,
    I have read the sdk doc and API and opened the sample in vs2010,but no idea about how to operate the pdf doc in illustrator with api.
    Hope more advise or any examples,thank a lot.

Maybe you are looking for

  • How much memory can i upgrade on my macbook pro?

    I have a mid year mackbook pro 2009 with 2gb of memory. When I updated to Lion my system has begun to crawl and barely function. I want to upgrade my memory and I would like to get 8gb of memory from crucial...I don't know if my computer can hold tha

  • How do I set up my Itouch 4gen to send/receive TISCALI emails

    Please can someone help. I am flying out of the country tomorrow and bought yesterday an ipod touch 4g so that I can keep in touch re an urgent matter at home. I want to add my tiscali email account. I am entering all the details exactly onto my touc

  • Spotify is hijacked by free youtube to mp3 convertor when it tries to update and re open

    I have been having this problem for a few weeks now. The only solution is to uninstall spotify and re-install it. This would cure the problem for a few days but now it will not even cure it for a few minutes. If I reboot windows and open up Spotify t

  • ABOUT THE HR-ABAP

    Hi, i hope every body is doing good. Here i am having the query on payroll. Here i want to retrive the payroll result for india, in the payroll data i want know the wage types which are belogs to infotypes 0008,0014 and 0015. a immediate reply will b

  • Move Adobe Acrobat from 1 laptop to another

    How do I move my adobe acrobat registered program (8.3.1) from 1 laptop to another.  I would like to use the original disc that I have to register on the new laptop but can't while it is registered on the current.