03-12-2012 02:09 PM
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:
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
03-12-2012 02:15 PM
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.
03-12-2012 02:32 PM
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?
03-12-2012 02:41 PM
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...
03-12-2012 02:45 PM
Do you have any links to documents discussing this?
Chris
03-12-2012 04:36 PM
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.