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
Glad it worked out! I've used those vi's in the past to write Matlab files for colleagues. One caveat though, those vi's are quite general and can write any type of .mat file; however, if you are always going to use a 2d matrix of U8's you may want to modify those vis as the consume quite a bit of memory. I had to modify them in order to save millions of doubles to a file. I lost the generality, but gained speed and memory improvements. Cheers, mcduff
0 Kudos
Message 11 of 16
(649 Views)

@PA_UW wrote:

size(val)

 

should be something like

 

3  277453


The example above is NOT three U8 values. Neither 277 or 453 can be represented using 8 bits. Are you sure that Matlab is expecting U8 values?



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 12 of 16
(644 Views)

You misunderstand - I was just saying what matlab will respond with when the file is properly loaded and the size(val) command is run the 3 represents 3 columns/channels and the 277453 is the number of samples per channel.

0 Kudos
Message 13 of 16
(641 Views)

@PA_UW wrote:

You misunderstand - I was just saying what matlab will respond with when the file is properly loaded and the size(val) command is run the 3 represents 3 columns/channels and the 277453 is the number of samples per channel.


Ok, that is a different story than.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 14 of 16
(634 Views)

Just on a sidenote, in addition to the simplifications already pointed out, your code is still crawling with bugs. For example you definitely need to wire the offset output of the header subVI to the offset input of the second subVI. Without that, the header will get immediately overwritten (just open the resulting mat file in notepad to see).

0 Kudos
Message 15 of 16
(631 Views)

Thank-you so much for your help.  I was just doing a quick and dirty hack with the example given trying to get a readable .mat file - definitely not refined programming - thanks for taking the time to find that error.

0 Kudos
Message 16 of 16
(623 Views)