LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

import data from labview to matlab

I want to import data from labview to matlab. I found this in KnowledgeBase: http://digital.ni.com/public.nsf/websearch/562D29142BF79B4E862570D10074E3CC?opendocument&Submitted&&node=133020_US

I tried the ASCII format. It works if the spreadsheet contains not so much data. I have to break the spreadsheet into several sub spreadsheets if there is too much columns in it. Though it works, it's not pratical for me. Because I have lots of files. So I tried the binary format.

The example posted there doesn't work in LabVIEW 8.5 that I am using.

Does anyone know how to modify it for LabVIEW 8.5?
0 Kudos
Message 1 of 10
(12,217 Views)
Hi mbei,
i´m a little bit confused. Which format does work for you, but is not practicable? Which example doesn´t work? Can you explain it please? If i use the example from the knowledge base article, i can create a file without an error.

see this as additional information http://forums.ni.com/ni/board/message?board.id=250&view=by_date_ascending&message.id=40067#M40067 
[only this message, because you know the rest Smiley Happy]

Mike

Message Edited by MikeS81 on 05-16-2008 09:39 PM
0 Kudos
Message 2 of 10
(12,210 Views)

Hi Mike,

I can't access the files in my office at home. So I can only describe the problems I met for now.

The ASCII format partially works.  For some reason I couldn't load the file generated by LabVIEW Write to Spreadsheet File.vi directly by MatLab. I had to copy and paste a portion of the columns in the original file to a new Spreadsheet file.  Then MatLab can load the new file.  I have to create a few ( maybe a lot ) separate spreadsheet files in order to use all the data in the original file. So it's impracticable because I will have a lot of files need to be processed.

Then I tried the example attached in the knowledge base article. The article's link is:

http://digital.ni.com/public.nsf/websearch/562D29142BF79B4E862570D10074E3CC?opendocument&Submitted&&...

When I used LabVIEW 8.5 to open the SaveAsMatFile.vi and run it, there was a pop-up window asked me to select a file. I selected the file I wanted to convert and click OK button. There was no error message. But it stopped in less than 0.5 second. Basically, it stopped right after I clicked the OK button. I checked the selected file and the file was the same as before. I check the Conv2Mat.vi used by SaveAsMatFile.vi, there was error message in the front panel ( not a pop-up window ). The message was: " Source. Convert to MAT (data). " 

I couldn't get the converted file. The file I wanted to be converted is unchanged and there wasn't new file created.

The knowledge base article says: " The example SAVML Example.VI in the attached zip file, available for LabVIEW 7.1 and LabVIEW 8.0, can be used to save LabVIEW data in the MATLAB® .mat format. " So I suspect the SaveAsMatFile.vi and/or Conv2Mat.vi can not run properly in LabVIEW 8.5.

Which version of LabVIEW you are using?

I hope my description is detailed enough. I can send you my data files and screenshot next Tuesday if you think it's helpful.

 

Best Regards

Min

0 Kudos
Message 3 of 10
(12,177 Views)

Hi Min,

you have to select the target file if the popup window ask you for a file. Did you see the content help of the vi? You have to open the file you want to convert seperately and connect the data to the 2d input.

Mike



Message Edited by MikeS81 on 05-17-2008 09:10 AM
Download All
0 Kudos
Message 4 of 10
(12,161 Views)
Hi mbei,

This article might also be helpful for you if you would prefer to use the TDMS file format:

Reading TDM/TDMS Files with The MathWorks, Inc. MATLAB® Software
http://digital.ni.com/public.nsf/allkb/0EEADA99DC7D00A4862572E30037C3A2?OpenDocument

I hope this helps!
Regards,
John Bongaarts
0 Kudos
Message 5 of 10
(12,110 Views)
Just an idea, and this has worked for me in the past. You can use .csv files to write and read with both matlab and labview. In matlab there are callers for csvwrite and csvread. In labview you can write a spreadsheet file with a comma delimiter. I have used these successfully when all else has caused problems transfering data from one language to the other.

Tom
0 Kudos
Message 6 of 10
(12,096 Views)

Hi,

I don't find these files SaveAsMatFile.vi  Conv2Mat.vi  in the posted link http://digital.ni.com/public.nsf/websearch/2f8ed0f588e06be1862565a90066e9ba?OpenDocument

Anyone can help please?

Thank you.

0 Kudos
Message 7 of 10
(11,716 Views)

Hi,

 

You need to download the .zip file linked at the bottom of the document.  That contains the files you need.

 

Regards,
John B.
AE Specialist - Test Products
National Instruments

 

 

Regards,
John Bongaarts
0 Kudos
Message 8 of 10
(11,713 Views)

Hi again,

The attached file in the page (.ZIP) cannot be opened (server cannot be found).

Thanks.

0 Kudos
Message 9 of 10
(11,689 Views)

Hi,

 

It looks like that was not correctly linked.  Here's the attachment until it is fixed.  Sorry about that.

 

Regards,
John Bongaarts
AE Specialist - Test Products
National Instruments

Regards,
John Bongaarts
0 Kudos
Message 10 of 10
(11,672 Views)