LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save data in new column for each pause trigger pulse

Hello,

I am using DAQmx for data acquisition on Windows 10.

I know how to make a 2D array to store two different data let say (x,y). But how about having 1000D array or more ? In my experiment I am using pause trigger to collect signal for certain wavelenght range. The trigger starts with every laser scan pulse ( laser runs in sweep mode controled witth an external software. I am making N laser scans for the same wavelenght range. I will have N pause trigger though). For every pause trigger I want to collect the output data (100000 samples) into a new column. At the end of the N scans I must  have an array with N columns (Y axis). For the moment all recorded data  are in one column. The idea behind having the data stored into different columns is to make an average over N scans. Hope I am more clear now. Any idea ?  Enclose the simplified version vi. Thank you 

0 Kudos
Message 1 of 9
(2,962 Views)

You need to start over with a proper architecture like a state machine. 

 

Then it's simple a matter of putting your results in a 2D array and moving to the next column each time. 

Or if you have it using the report generation toolkit to write to a new column in Excel each run.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 9
(2,937 Views)

RTSLVU thank you for your reply.

I know the code I posted looks ugly and not friendly :). Beside that, you suggest that it is matter of putting my 2D results array and "moving to the next column each time" . My whole problem is how to move to next column after each pulse is received ? It seems easy for you but not for me 😞  Do you have an example for that ? Thank you  

0 Kudos
Message 3 of 9
(2,928 Views)

Well a 2 dimensional has rows and columns. Rows and columns are selected by their Index.

 

You have to keep track of what column (Index) you are writing to, starting with zero and increment that Index for each "run".

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 9
(2,925 Views)

The simplest way to index larger arrays is to use Nested For Loops. Check out the examples in the forum post below.

http://forums.ni.com/t5/LabVIEW/nested-for-loop-index-to-array/td-p/392458

 

 

0 Kudos
Message 5 of 9
(2,895 Views)

Hi A_Hint_From_Tr…                  

 

Thank you for your reply. These examples are OK, but they are based on building 2D array ( you have two array as you can see).

my concern is how to built 10000D array and then average them all. Thank you

0 Kudos
Message 6 of 9
(2,867 Views)

You shouldn't need a 1000D array, you should be using a 2D array (X&Y) with 1,000 rows and 1,000 columns. You can use the previous example and create your 2D array but wire a constant of a 1,000 to the count terminal "N" for both the inside and outside For Loops. Then as you acquire your data you can write it out to the first column, then increment to the next column and write the next 1,000 data points in the second column and so forth. You can include an additional loop structure to increment through each column after each write cycle. 

0 Kudos
Message 7 of 9
(2,848 Views)

@klebris wrote:

Hi @A_Hint_From_Trent                  

 

Thank you for your reply. These examples are OK, but they are based on building 2D array ( you have two array as you can see).

my concern is how to built 10000D array and then average them all. Thank you


10000 dimensions? I think you are confusing array demensions with array elements.

https://en.wikipedia.org/wiki/Array_data_structure

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 8 of 9
(2,846 Views)

Thank you for your reply A_Hint_From_Tr…  .  I have solved my problem. Thank you

0 Kudos
Message 9 of 9
(2,830 Views)