02-28-2013 04:53 AM - edited 02-28-2013 04:56 AM
Hi all,
I've started a collaboration with another department who would like to use my 3D Array data (collected and created in LabVIEW) within their MatLab code. I've searched on the forum, but so far nobody seems to have a clue on how to get 3D Array data into matrix format within MatLab? Doesn't need to be live.
So is there a way to save 3D data in such a way that it'll can be loaded with MatLab not changing structure?
EDIT:
* It is numerical data
* DBL format
* Array is a 27000x9 with 2500 layers (dimensions I think they refer to within MatLab?)
Solved! Go to Solution.
02-28-2013 06:20 AM
See if this is what you're looking for:
Send N-Dimensional Arrays into a MATLAB® Script Node
02-28-2013 06:50 AM - edited 02-28-2013 06:50 AM
Hi Chris,
It does look promising, however the code in MatLab will run of their servers and not of the local computer which I'm using. So I will need to export my LabView array to load it in to MatLab (which they'll do). I managed to do it with a 2D array (easy) but I cannot get it to export the 3D array
Thank you for your response btw
02-28-2013 07:49 AM
So are you trying to write .mat files?
If so you need to use the DataPlugin toolkit and the .mat plugin: MATLAB® DataPlugin
However, I see you point that it only supports up to 2D arrays.
Can you have MATLAB on your computer as well as the server? If so, you could use the MATLAB script node as I mentioned before and save the .mat file from there.
02-28-2013 07:49 AM
It has been a while since I used MATLAB and I never tried to do what you are trying.
My suggestion is to have them save a small file from MATLAB - one that they can read back. Have the values in each dimension be distinctive so you can tell which value is in which position. Then have LV generate a file with the same format.
That file will be ~5 GB in binary, so be very careful if you are thinking of a text file solution. The files will be huge and the processing slow.
Lynn
02-28-2013 07:59 AM
Sweet never thought about doing it that way! Brilliant idea! Let me get on top of that, but I cannot see a problem with that!
Thanks!
06-17-2014 03:14 PM - edited 06-17-2014 03:15 PM
You can do that by using HDF5.
Install these two things:
http://www.hdfgroup.org/HDF5/release/obtain5.html (choose operating system and bit-version of Labview (32/64 bit)
http://h5labview.sourceforge.net/
Open a mat-file and add HDF5 datasets to it using the h5 library. The resulting .mat file will be readable in matlab.
06-17-2014 07:51 PM - edited 06-17-2014 07:54 PM
Look at http://sourceforge.net/projects/matio/
You will probably have to modify it, as it uses a lot of memory; too many string concatenations.
The other option is save as TDMS and have them import it to Matlab.
Cheers,
mcduff
Sorry
I gave you the wrong link.
06-18-2014 11:15 AM
This example writes a 3D dataset to a .mat file. I think with minimal memory usage, but I have not tested that.
We use it to write image data on the fly to an SSD. It writes 256x256 uint16 frames with 1000 fps (134MB/s)
just rename header.ppt into header.mat (cannot add attachements with .mat extension apperently)
12-05-2017 11:46 AM
Hi,
I am looking for generation of matlab file from labview which is 2D. and that to multiple separate arrays in the sequence. can you please help me out how to save a .mat file with multiple arrays in the file.
thanks,
Shravan Kumar Parakala