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: 

Toggling program to sort data sets during acquisition

Solved!
Go to solution

Here are the other two programs.

 

Unfortunately I cannot submit the typical output because I do not have access to the machine. But, the output is a 2D array with the 0th row as the x-axis and the 1st row as the y-data. 

 

mrphud

Download All
0 Kudos
Message 11 of 20
(761 Views)

Which SRS model are you using DG645?

0 Kudos
Message 12 of 20
(756 Views)

The 2D Waveform to 1D Array.vi seems to just select the first row of the 2D array.  Index Array would be much easier, if that is what you want it to do.

 

But it seems more likely that you want the second row (y-axis data) and perhaps the third row when you start acquiring the laser trigger signal.

 

This is where typical data becomes much more useful than guessing.  Without being able to see the data is it almost impossible to suggest ways of hepling you get what you want.

 

Lynn

Message 13 of 20
(751 Views)

It's a DG535. But, I have two of them, so I am able to generate two repetition rates.

0 Kudos
Message 14 of 20
(746 Views)

Hi Lynn,

 

I decided to use index array instead of my sub vi, you are correct it is much easier. As for the data, it is the output of a waveform graph. The standard output of a waveform graph is precisly what you said. 0th row is x values, 1st row is the first set of y values, and the 2nd row is the second set of y values. This should eliminate the guess work.

 

Can we at least play out this scenario? I tried to use decimate array but it only seems to work with 1D arrays. Is there a way to decimate the 2D array?

 

Thanks

mrphud 

0 Kudos
Message 15 of 20
(737 Views)

Yes, the Decimate Array only works with 1D arrays.

 

If you put Decimate Array inside a for loop, it will decimate each row separately. Depending on what you want to do with the data later you may need to use Index Array to select a particular row or column from the decimated arrays.

 

Is the laser on data in odd columns and laser off in even columns or is it distributed some other way?

 

Lynn

 

 

0 Kudos
Message 16 of 20
(730 Views)

Whether the laser on data is in even or odd will (I believe) change from scan to scan. This is because I have no way to set the program to start the scan in the same state every time. 

 

Also, I don't need to decimate my 1D array. I need to spilt the collection of 1D arrays, hence a 2D array, into a group of 1D arrays of the same data type. I suppose I could do this with an extra for loop and index array.

 

The better way would be to use the second row of the oscilliscope output to check whether the laser is on.

 

So this is now the question. If I sent a square pulse to the second channel, at irregular intervals, how could I detect whether it was there or not?

0 Kudos
Message 17 of 20
(726 Views)

I have attached a little VI which shows some of the concepts I have been suggesting.

 

Splitting the arrays can easily be done with Index Array.  No loops required.  The Index Array function can be expanded to get multiple rows (or columns) simultaneously.

 

The third row of Array in my VI has a value of 20 for one state of the laser and 25 for the other state.  The second row has data which increases linearly with time except that I added 20 to the value if the laser was on.

 

Array 5 has the laser off data and Array 6 has the laser on data.  The use of NaN was so that the data do not appear on the plot and so that the arrays could be truncated later for further processing.

 

Note that Initializing the arrays outside the for loop and using Replace Array Subset inside the loop avoids memory re-allocations and is the preferred way to handle arrays which might become large.

 

From some of the questions you are asking it seems that you do not have much experience with LabVIEW.  The on-line tutorials are a good place to start.

 

Lynn

 

0 Kudos
Message 18 of 20
(718 Views)

You are correct. I have a decent understanding of programming, but I am new to labview. In any case, I appreciate your help.

 

mrphud

0 Kudos
Message 19 of 20
(706 Views)
Solution
Accepted by topic author mrphud

As an update I am posting the code that I believe is finished. I was able to use a second "trigger pulse" to tell the program whether the laser was firing or not. That is the min max comparison for the data from channel two. From here I will integrate the averaged subtracted signals. See attached file.

0 Kudos
Message 20 of 20
(690 Views)