From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert 1D waveform to 2D waveform

Solved!
Go to solution

My problem is I want to write a graph to daqmx write that will be read by daqmx read. The way I have it now is a 1D waveform. My code is attached with the post. My goal is to create a waveform array of 8 channels of all zeros and select which channel I want to pick to apply a waveform to. If I pick channel 1 and 3. Those two will be affected by a sinewave and the remaining will be a waveform of all zeros.

I mean if I have a waveform of all zeros and I feed it to the replace array subset(top sink) and I have an actall waveform and feed that also to the replace array subset(bottom sink). I used a 1D numeric control or a listbox to index in the new array. If my index value is 1 and 3. That means row 1 and 3 that were all zeros will be replaced by the waveform (sinewave) and the remaining rows(0, 2, 4, 5,6 ,7) will still be a waveform of all zeros.

But as far as display goes, since my waveform is a 1D array I cannot display more than one waveform on the graph. how can I code this in a way  where I get a 2D array of waveform for each channels. I know I cant write a 2D array of waveform to daqmx write but what can I do so I can select multiple waveform to display. Right now each graph are displayed one after another. seet photo

Thanks in advance. see attached picture 

 

Admin Note - Attachments removed per user's request

0 Kudos
Message 1 of 13
(3,043 Views)

I think what you want is a 1-D array of waveforms to send to a Graph.

 

it's not very clear though.

 

I dont' get this part: "select whihc channel I want to pick to apply a waveform to"

 

Do you mean that you want to activate only a single channel on your multichannel DAQ?

0 Kudos
Message 2 of 13
(3,033 Views)

I mean if I have a waveform of all zeros and I feed it to the replace array subset(top sink) and I have an actall waveform and feed that also to the replace array subset(bottom sink). I used a 1D numeric control or a listbox to index in the new array. If my index value is 1 and 3. That means row 1 and 3 that were all zeros will be replaced by the waveform (sinewave) and the remaining rows(0, 2, 4, 5,6 ,7) will still be a waveform of all zeros.

0 Kudos
Message 3 of 13
(3,028 Views)

OK. So start with a 1-D array of zeroed out waveforms.

You have your sample waveform that you'd like to replace elements of that array with.

You're using a multiselect listbox to pick which indices to replace.

You're running your listbox indices into a for loop and replacing the individual elements of the 1-D array of waveforms via shift register.

You're then sending the 1-D array of waveforms to a DAQmx Write.

 

Which part is giving you trouble?

0 Kudos
Message 4 of 13
(3,019 Views)

My problem is If I select 3 indicies in the listbox, this how my plot comes out like on the grap. see picture piv.png attached in original post. I want to see multiple plots displayed on top of each other. they look like they're being appended on the graph whihc  isnt right

0 Kudos
Message 5 of 13
(3,009 Views)

I can't tell from your Waveform Generator function whether it has a t0 input or not.

Essentially you need to reset t0 to be the same value for your waveforms.

From the LabVIEW help:

Basic Function Generator Details

This VI remembers the time stamp of the previous waveform generated and continues to increment the time stamp from that point. It takes as inputs the type of waveform, number of samples, phase in, and the frequency of the waveform to be generated in Hz.

0 Kudos
Message 6 of 13
(3,000 Views)

yea but that has nothing to do with my problem. And yes the waveform generator does have a t0

My assumption is I cant display more than one plots or channels on the graphs because my waveform is only 1D. each color that you see on the graph in the pic is a different channel in my opininon.

0 Kudos
Message 7 of 13
(2,996 Views)

Each color is a different channel.

It's just that your generated channels have a different t0 than your initial channels.

 

EDIT: Turn on the Plot Legends and you'll see you have multiple channels.

0 Kudos
Message 8 of 13
(2,989 Views)

Thanks for your help but that didnt fix it. i believe the problem is much more complicated than that.

0 Kudos
Message 9 of 13
(2,986 Views)

I disagree or don't understand.

Use the Align Waveform Timestamps VI prior to graphing and you should get what you want.

0 Kudos
Message 10 of 13
(2,984 Views)