LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

3D Array from LabVIEW to MatLab

Solved!
Go to solution

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?)

 

 

 

0 Kudos
Message 1 of 10
(6,532 Views)

See if this is what you're looking for:

 

Send N-Dimensional Arrays into a MATLAB® Script Node

Chris
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 2 of 10
(6,512 Views)

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

0 Kudos
Message 3 of 10
(6,507 Views)
Solution
Accepted by topic author Paddy1985

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.

Chris
Certified LabVIEW Architect
Certified TestStand Architect
Message 4 of 10
(6,495 Views)

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

0 Kudos
Message 5 of 10
(6,494 Views)

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!

0 Kudos
Message 6 of 10
(6,488 Views)

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.

Message 7 of 10
(6,034 Views)

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.

Try http://sourceforge.net/projects/matio-labview/

0 Kudos
Message 8 of 10
(6,023 Views)

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)

 

Download All
0 Kudos
Message 9 of 10
(5,990 Views)

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

0 Kudos
Message 10 of 10
(4,748 Views)