LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Struggling with Converting a 2-D array of U8 data to a Matlab file format?

Solved!
Go to solution

I am struggling trying to convert a simple 2-D array of U8 data (3 channels) to a matlab file format.  I have been manipulating the examples found in the labview2matlabni folder - but I can't get it to read in Matlab - the matrix is unreadable - says inconsistent number of columns. 

 

I have included my vi with a sample of the data saved as input.  I am sure this shouldn't be so difficult!

 

Thanks in advance - any help is appreciated!

 

 

0 Kudos
Message 1 of 16
(3,043 Views)

Do you have a link to a documentation of this file format?

 

You code seems overly complicated with a lot of unecessary operations. For example, to take the product of all dimensions, you could just do a "multiply array elements", no loop needed. 

 

Who wrote the two subVIs?

 

For example, the entire left side of your code could be written as follows:

 

 

0 Kudos
Message 2 of 16
(3,037 Views)

The data is just three channels of U8 data - that is it in terms of format.  I just hacked a few of the examples (LabviewtoMatlabvi) I found on the ni site with what I thought I needed to save as .mat. 

0 Kudos
Message 3 of 16
(3,033 Views)

These are all the .vis that I have found from searching the site - but none seem to work for me.  I keep getting the same error about the inconsistent number of columns and unable to extract matrix size from file.

Download All
0 Kudos
Message 4 of 16
(3,030 Views)

I am still struggling with this problem - I cannot get this simple 3 channel array to be read in matlab - I have been exploring the matlab dataplugin but I can't make sense of it - I would really appreciate any help out there!

 

Thanks!

0 Kudos
Message 5 of 16
(3,004 Views)

I do have matlab here, but I am very unfamiliar with it. Can you show a few lines of matlab code to demonstrate how you are trying to read it? This way I can do some experiments myself. Thanks.

Message 6 of 16
(2,994 Views)
Solution
Accepted by topic author PA_UW

If you haven't doen this already,

 

You may want to check out this site, http://matio-labview.sourceforge.net/. I believe there are VIs for saving and importing .mat files.

 

Cheers,

mcduff

Message 7 of 16
(2,992 Views)

at this point I am just trying to load the file in with:

 

load('filename.mat")

size(val)

 

right now I can't get passed load!

 

thanks.

0 Kudos
Message 8 of 16
(2,986 Views)

size(val)

 

should be something like

 

3  277453

0 Kudos
Message 9 of 16
(2,982 Views)

I had not seen this:  http://matio-labview.sourceforge.net/

 

Thank-you so much!!  I think this solves it.  Not sure what was going on with those other programs...  but this one seems to work. 

 

Most appreciated - made my day!

0 Kudos
Message 10 of 16
(2,966 Views)