LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquire signals using Labview and Process them using Matlab

Solved!
Go to solution

Hi I am searching for a method to send the signals from basic Labview kit to Matlab for processing. I have searched a lot in related topics but didn't find a clear answer.I am aware that it would be best to do the processing in Labview also but I don't have the full version of it. I found this link that shows some ways of doing it:

http://digital.ni.com/public.nsf/allkb/2F8ED0F588E06BE1862565A90066E9BA

If I am not mistaken, the first 2 steps: using Matlab Script Node and Labview MathScript RT Module are only accessible with the full or professional kit. So this leaves MATLAB® Data Plugin or saving data in (.mat). I need to transfer about different 20,000+ signals for each experiment so are any of the 2 options left applicable for my case? And if yes can you tell me the steps that I should follow to get the results? Note that I won't have access to Labview software until I am sure that a solution exists.

I would appreciate any help I can get. Thanks in advance.

0 Kudos
Message 1 of 14
(3,757 Views)

Hi Kamelbh,

 

So this leaves MATLAB® Data Plugin or saving data in (.mat).

Well, I'm sure Matlab can read simple text files and CSV files too - both are easy to create with LabVIEW, maybe easier than .mat files…

And both LabVIEW and Matlab can also write/read "binary" files when you are in charge of their file structure!

 

I need to transfer about different 20,000+ signals for each experiment

Wow, that's a lot! 20k+ signals? What kind of experiment do you want to maintain when you don't have the money to buy the full version (or any suite) of LabVIEW?

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 14
(3,753 Views)

I will be scanning an area by sending/receiving ultrasonic waves in order to finally produce an image of it. That's why I will need many signals for each scan to increase the resolution of the image. The university already has the full Matlab license, so if the signals that can be acquired by basic labview can be later processed using Matlab without any problem then there is no need to get the full labview version for my application.

0 Kudos
Message 3 of 14
(3,735 Views)

Hi Kamelbh,

 

The university already has the full Matlab license, so if the signals that can be acquired by basic labview can be later processed using Matlab without any problem

AFAIK Matlab also provides a lot of toolboxes and function libraries to access DAQ hardware.

Why don't you stay with Matlab for all the work? No need to buy another software license…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 14
(3,703 Views)

I'm a little confused as to what you want to do.  It sounds to me that you want to do most of your data processing with MatLab, for which you are fully licensed.  On the other hand, you talk about doing something with LabVIEW (but say you don't have a full license), so I'm not sure what you want to do in LabVIEW, nor how you want to connect the two.  The reference you gave seemed to be "How to import MatLab files for analysis in LabVIEW", which I thought was the opposite of what you wanted to do.

 

It's unclear what the data are you hope to acquire.  LabVIEW might be a good system for acquiring your data.  If you are committed to not using LabVIEW for the analysis part, as well, but rather using MatLab, you need to think about how to get your data into a format that is "MatLab-Friendly".

 

Depending on the format of your data files, writing binary data files might not be a bad choice.  One drawback, of course, is you need to know the format of the data, and there aren't "internal directories", but if it largely sampled data from a known number of channels at a known data rate, LabVIEW can certainly write such files and MatLab can certainly read them.  [You need to be careful -- I recall that MatLab uses a different byte ordering than other systems, but MatLab can specify the byte ordering, so you can experiment and figure out which is right].

 

Bob Schor

0 Kudos
Message 5 of 14
(3,683 Views)

Hi GerdW,

That's true, I think with the Matlab package I have access to I can acquire and process the data, but I have been told that Labview can show a better quality of the signal than matlab so I'm checking my options.

Regards,

Kamel

0 Kudos
Message 6 of 14
(3,672 Views)

Hi Bob,

 

LabVIEW might be a good system for acquiring your data.  If you are committed to not using LabVIEW for the analysis part, as well, but rather using MatLab, you need to think about how to get your data into a format that is "MatLab-Friendly".

 

That is what I want to do. The labview will be connected to an oscilloscope(which is connected to ultrasonic transducer) and acquire all the signals (pulse echo signals). Then automatically save the signals separately and after that move them to Matlab for more processing of the data. Do you know how long approximately it would need to move and process 20k signals using the method you suggested assuming the data rate is fixed?

 

Regards,

Kamel

0 Kudos
Message 7 of 14
(3,670 Views)

HI Kamelbh,

 

I have been told that Labview can show a better quality of the signal than matlab so I'm checking my options.

Why should Matlab show a different signal than LabVIEW when you access the very same DAQ hardware???

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 14
(3,665 Views)

Because LabVIEW uses the principles of Data Flow, it is an inherently "parallel" language.  You describe 20,000+ data points, but don't say what your acquisition rate is (how many samples/second), how many channels, for how long, whether continuous or "in burst", etc.

 

Generally, data acquisition hardware does a lot of the processing "within the hardware", and actually may not require much CPU time even when transferring data to CPU memory (probably uses some DMA hardware).  So the question comes down to "how fast can you stream the data to disk?".

 

We routinely acquire 16-24 channels of analog data at 1KHz (a modest rate) on one instrument, stream it via TCP/IP to the host PC, which displays a sub-sample (we display 50-point averages, so the display updates at 20 Hz) and stream everything to disk.  We can record for as long as we have disk space, with almost all of our records having >20K points.  So LabVIEW can easily acquire/save all the data.  We also process the data in LabVIEW (as, in my opinion, writing LabVIEW code is much easier, particularly when it comes to debugging, than MatLab), but we also have users who "only know MatLab" and have developed their own routines to handle the same data.

 

Bob Schor

0 Kudos
Message 9 of 14
(3,658 Views)

Thank you for your message, I will try to describe the operation in more details:

I will use a 10MHz transducer so in order to get good data the sample rate should be 10 times larger so around 100MS/s (reference: http://www.ndt.net/article/dresd97/csapo/csapo_e.htm). My application is not a continuous signal, it is a pulsed signal of 5 microseconds width that will be repeated every 200 microseconds (5khz). The step accuracy will be 0.01 microsecond (based on the sample rate chosen).

 

As I mentioned previously, I am scanning an area which will need around 100 strokes to complete. Each stroke will take around 4-5 seconds to complete. There will be a small delay in measurements between each stroke (for the transducer to reach the new location) so each stroke data can be considered separately.

I will use only 1 channel.

 

("how fast can you stream the data to disk?") I'm not sure how to find the required speed. I was planning on using a USB cable as the connection with the oscilloscope but if that won't give enough speed then I can use a gigabit Ethernet instead which should be much faster (reference: http://www.ni.com/product-documentation/5897/en/).

 

Regards,

Kamel

0 Kudos
Message 10 of 14
(3,635 Views)