LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Basic question: reading waveform from Matlab, sending to a DAQ.

I would like to read a waveform generated in Matlab, then send this waveform through the PXI-6221 analog output.  At the same time, I would like to acquire the received signal through my PXI-6133.  I figured out how to do the second part, but not the first part.

I tried saving the Matlab signal as an ASCII file (following example at NI.com), for example:

 -8.8908899e-005
 -6.6427555e-004
  1.3617777e-005
  ...

I used a "read from spreadsheet" vi, specifying the output to be a "double".  How do I convert this output into a waveform?  LabView doesn't seem to think that it's a waveform, it doesn't even display properly on a Waveform chart or graph.

Is there an example file that I can use??

Thanks in advance.
0 Kudos
Message 1 of 8
(3,651 Views)
Read From Spreadsheet should work just fine but if you don't include timing information in the file, you will need to provide that before you can output it. When you say it doesn't display properly, what exactly do you mean? Is the shape not correct or is it something else? Can you post an example of your data file and the code you've written?
Message 2 of 8
(3,648 Views)
Dennis, thanks for the reply.

The display is pretty much blank.  I think you are correct that I should have included a timing information.  I thought that NI would just give it integer indices by default. 

One question first though:  does NI read spreadsheets column-wise or row-wise?  Should I then make say two columns, one for time and the other for the actual value?  Or do I use a "waveform generate" vi and put in \delta_t?

Thanks in advance.
0 Kudos
Message 3 of 8
(3,647 Views)
If you have a blank graph, my guess is that you wired up the 'first row' output from the Read From Spreadsheet. This is the 1D array output and since you only have a single element in the first row, all a graph will have is a single point on it. To use the 'first row' output with a file with a single column, wire a True to the transpose input.
 
If you have no timing information, then the x-axis of the graph will default to an interval of 1 between points.
Message 4 of 8
(3,642 Views)

Dennis, thanks for your help.  You were correct that I should have transposed the data.  Now the bad news is that the second part that I thought I had gotten working does not work.

In "Joint_Tx_Rx_chirp_singleshot_multichan_v03.vi" I set up a VI to:

 1.  Generate a chirp signal, with given length, freq range, sampling freq.

 2.  Send this signal out through the PXI-6221 into my "channel".

 3.  And at the same time, record the output of the "channel" using the PXI-6133.

 

What I want to do now is to replace (1) with a Matlab-generated signal.  I copied the "transmitter" part of my VI that works, but now I get an error message "200077 - requested value is not a supported value for this property" or if I don't use "build waveform" I get "2200609 - buffer too small". 

How does one change the size of the buffer in DAQmx?

I am also including an example signal file that I'm trying to send.

Thanks in advance,

Julius

0 Kudos
Message 5 of 8
(3,613 Views)
I set the transpose to True instead of False and had no error. I also don't understand the wiring of the graph and chart to the 2D array. Since you have a waveform chart wired to the output of the Build Waveform, there is no need for the others anyway.
0 Kudos
Message 6 of 8
(3,606 Views)
Dennis, thanks for looking at the code.  I appreciate your help.

Unfortunately, on my system I keep getting the same error message from DAQmx.  I guess I'll have to call tech support to see what they have to say.

It is surprising to me that I was able to get the whole setup working with Labview-synthesized signal (the chirp), but replacing the chirp with a signal read from a file gave me a lot of grief :-P.

Thanks again,
Julius
0 Kudos
Message 7 of 8
(3,595 Views)
Do you see the correct signal on the waveform chart you have wired to the output of the Build Waveform function?
0 Kudos
Message 8 of 8
(3,588 Views)