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: 

insert into array - how to append to the same raw?

Hello,

 

I have a problem with Insert into Array.

 

I have basically two loops, and data are generated each time. What I currently get, in case of, for example, 2 outer loops and 4 inner loops, is something like (see attached excel file) :

 

1.7   1.8   2.4   3.6

1.7   1.8   2.4   3.6  8.14  1.5  1.3  1.6

 

i.e. when the outer loop takes place for the second iteration, the data is being appended to the old one but in a new raw.

 

What I want is to have the second raw above as the first and only raw.

 

See:

 

test.JPG

 

The keithley buffer gives me a string of numbers of length 11 plus a comma and a space = 13, thus the numbers shown above, but please ignore these

since they work perfectly and my problem is only within "insert into array".

 

Thanks for your help,

ali8

Download All
0 Kudos
Message 1 of 11
(3,532 Views)

Try using a shift register and build array.

 

Right-click on the array terminal at the edge of the for loop and select "Replace with Shift Register".

BuildArray.png

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
Message 2 of 11
(3,517 Views)
not working. each time i run the program it accumulates over old data.
0 Kudos
Message 3 of 11
(3,484 Views)

Show us the new code. Maybe you don't want to initialize the shift register?

Message 4 of 11
(3,477 Views)

Do you mean that the data accumulates, appending to old data (not writing over it).

 

Try using a Waveform Graph instead of a Waveform Chart.

 

They are different, the chart accumulates data by design, the graph does not.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
Message 5 of 11
(3,446 Views)

The idea is not only in the Chart/Graph, there's data written to Excel, so changing the chart/graph does not eliminate the problem.

 

I will check tomorrow and get back to you guys, and thanks in advance.

0 Kudos
Message 6 of 11
(3,434 Views)
I am not able at the moment to get the new code since that computer is in a Lab. But I tested using the shift register with build attay and it is not working. please if anyone have any idea please directly modify the code I provided at the beginning.
0 Kudos
Message 7 of 11
(3,409 Views)

What exactly do you mean when you say "it is not working". Can you please be more specific.

 

What do you want it to do that it is not doing? What output are you expecting on the graph and the in the csv file? (They will be different.)

 

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 8 of 11
(3,401 Views)

I mean that if you do more than one for loop "iteration", then each new iteration add new raw.

 

Thus you end up having something like this in .csv file (assuming each iteration adds two values 'v') :

 

v1 v2 0 0 0 0 0 0

v1 v2 v3 v4 0 0 0

v1 v2 v3 v4 v5 v6

etc

 

I want to open the .csv file and have only the last "updated" or "final" raw. There is no need for the first few raws corresponding to first few iterations.

 

 

0 Kudos
Message 9 of 11
(3,391 Views)
It is 'ROW'! Raw is how you would describe sushi.
Message 10 of 11
(3,383 Views)