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: 

array

Hello all,

 

i am workin on small project to LabVIEW about acquisiton values from signal. I need to let user to set parameters, from which i am creating array with preset values on axis X and Y (some range where i measure - positions). I need to take this preset array with every pressed button ACQUISITION and add there value to the proper position in array. I don't need help with acquision frome scope or anything, just to know how i can put there values after user interaction until he fill out whole table. I tried "Insert Into Array" but did not work. Any suggestions? I am attaching some pictures of front panel with array for better understanding.

 

Thank you so much for help!

 

Martin

 

 

 

0 Kudos
Message 1 of 7
(3,341 Views)

Honestly, your description is a bit confusing.

 

If you thought "Insert into Array" would work, you might want to try Replace Array Subset instead.

 

The first will grow the size of the array by inserting the elements into a spot and moving everything else back.  The latter will replace what is currently there with what you're trying to place there.

Message 2 of 7
(3,329 Views)

Simply, i just want to add there one value and move on another position as user will proceed. As it is on picture. The first row and column should be same (its only axis marking).

0 Kudos
Message 3 of 7
(3,312 Views)

As natasftw said, use Replace Array Subset.

 

Your array will be maintained in a shift registers.  In your code you'll need to manage the index values so that you advance the numbers properly on each iteration of the For Loop.

Message 4 of 7
(3,288 Views)

Do you have any code to show us where you are?  It is hard to give good advice without this context.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 7
(3,282 Views)

Hi,
explanation what is the meaning of columns and rows in your array would definitely help to understand what's your goal. Will be your array fixed size (lossy element insertion) or it should rather dynamically grow with each new incoming value (i.e. you would like to keep entire history)?

I attached very simple example of lossy row shifter that operates in the same memory space.

Good luck, have fun!

 

Ondřej K.

CLA, CTA, CLED
Message 6 of 7
(3,237 Views)

You have a 2D array and want to replace the value of a certain element with a new value. as others have said, "replace array subset" is the correct function for that. (you cannot insert a single element into a 2D array using "insert array element", because this function needs to grow the arrays so you can only insert and entire row or columns, and I don't thing that's what you are trying to do).

 

All you need is initialize a 2D array at the correct size (or use whatever 2D array you already have from previous operations) and keep it in a shift register.

 

Replace2D.png

 

Here is a quick example that initializes a 8x8 2D array, then replaces one element at a random position with a new random value (repeat for each iteration every 50ms).

 

0 Kudos
Message 7 of 7
(2,642 Views)