02-28-2013 02:24 AM
Hi,
I'm in the process of taking a fairly complicated MATLAB program and ideally embedded it within a Mathscript or if we have to, a MATLAB mode within LabVIEW.
Getting the code itself embedded has actually been a relatively straightforward task, but where I am having difficulties is how to get the appropriate data into the script node. This is a very easy task with simple data types (i.e. numerics, arrays etc), but the input for this node is quite complex (attached sample pic below) and I'm really not sure how is best to get this into the node. One possibility is to read it in within the node from a .Mat file, but then as we acquire the data in LabVIEW there would still be the task of converting from say a LabVIEW cluster to a .mat format.
Any ideas?
02-28-2013 06:28 AM - edited 02-28-2013 06:29 AM
If is were me, I would unbundle the cluster and send it into the MATLAB script node as more basic types and then reassemble it inside.
Data types get tricky with that thing.
I can't believe I'm posting this to the forums twice in less than 10 minutes, but you might find this helpful too: Send N-Dimensional Arrays into a MATLAB® Script Node
Try a process similar to that for your clusters.
<EDIT> Sorry, forgot you were trying to work mostly in MathScript node. My advice is still the same, though I don't know if those sessions persist (I don't think they do).
02-28-2013 12:32 PM
Someone wrote a library to read and write .mat files in LabVIEW: http://matio-labview.sourceforge.net/
(Also see the topic on LAVA: http://lavag.org/topic/10976-a-mat-file-io-library/)
I have not used this library, I just remember seeing the post about it and so am providing a link to it here.
03-01-2013 03:14 PM
Thanks for the info - I shall have a look.
Dave