03-15-2004 11:26 PM
03-16-2004 07:48 AM
03-16-2004 09:14 AM
03-24-2006 08:22 AM
05-19-2008 03:41 PM
06-09-2008 01:11 PM
Steffen, sorry for the late reply. I've been out of the office. It makes a difference which version of MATLAB you are using. Prior to 7, it was much easier (still excruciating, but managable). Since 7, both the LabVIEW code and "communication" code has gotten more complicated. If this is an option, I would consider compiling your matlab code in 6.5. Then the task of speaking with the dll from LabVIEW is much more straightforward. I apologize for not providing code; we are evaluating the possibility of commerciallizing this. The process is to create a standard windows dll (let's call it convert.dll) that understands matlab mxarrays. For inputs to the matlab dll, you call the correct function of convert.dll for the data type your are trying to send in (you can use polymorphic vi's in LabVIEW to call the correct function of the convert.dll from a single wrapper polymorphic vi). For example, to send in a double array, you call the polymorphic instance of the convert.vi that knows to call the correct dblarray2mxarray function of convert.dll. The output of this function and the vi is an 4byte pointer to an mxarray. You then pass this pointer into the matlab dll. On the output side, you do the reverse (you can still use use a polymorphic vi here, but you will have to manually select the correct conversion yourself, i.e., mxarray2int).
This may be a little confusing. To try to simplfy a little, you want to have the following:
- a matlab dll compiled from Matlab 6.5.
- a standard windows library for converting mxarrays to standard datatypes (and vice versa) convert.dll
- two polymorphic labview vi's: mxarray2labview.vi & labview2mxarray.vi with enough instances to handle whatever datatypes you are working with.
- and a labview vi where you will call everything listed here.
I hope this helps a little.
Chris
06-09-2008 03:49 PM
Hello Chris,
Thanks for your support. It will become crucial for our company to embed MATLAB code in LabVIEW. The MathScript option that LabView offers works for simple code but not for complex MATLAB code (no compatibility). You have mentioned also that you are evaluating the possibility of commerciallizing this. Is this something we could look forward to in the next few months?
In the meantime I try to get an old MATLAB 6.5 version as you have suggested.
Thanks,
Steffen