LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing data from LabVIEW to MATLAB

Hi,

 

I am generating a virtual instrument sine wave in labVIEW (with added noise). I wish to export the numeric amplitude and time values of my sine wave to MATLAB for some analysis there. This is a little odd I know, but I will eventually add on a CompactRio input and will process more complex data. However I want to test out LabVIEW and MATLAB integration first.

 

My questions are: 

  • What are the stages I must go through to export my data to MATLAB?
  • I know MATLAB can't handle real time data, so how do I go about saving my data before transfer?
  • Idealy I would like to be able to write a command prompt in MATLAB which loads my saved LabVIEW data into the MATLAB environment, is this possible?

I am using LabVIEW 11 and MATLAB 2011b and have most of the add on packages for both.

 

Thanks in advance for any assistance that can be provided.

 

Chris

0 Kudos
Message 1 of 6
(3,182 Views)

Simplest way is to save your data as a csv file and then you can literally drag and drop the data onto matlab, which you can then manipulate however you want.

0 Kudos
Message 2 of 6
(3,179 Views)

Thanks for the advice. I had a quick shot there and it did not work. I presume you use the  MATHSCRIPT node and the command csvwrite('input') where input is the inputed numeric data and then call the command csvread('input') in MATLAB? Is this right?

0 Kudos
Message 3 of 6
(3,174 Views)

Another alternative is to write the data to a .m file as vectors or matrices. The format is easy to generate and is well-documented.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 6
(3,171 Views)

Do you have any links to documents discussing this?

 

Chris

0 Kudos
Message 5 of 6
(3,168 Views)

No, I just make it into a csv file. I use the open/create vi to create a file and I put it as a csv file. I then input the data as shown in the subVI I've attached, before closing it again.

 

I hope this makes sense.

 

Once the file is written to, I open Matlab and just drag the CSV file onto the variable box. It automatically creates it there and I then can use whatever Matlab commands I want to do stuff to it.

 

Let me know if this still doesn't make sense and I'll try making an almost step by step example.

0 Kudos
Message 6 of 6
(3,158 Views)