Reputation: 492
I'm trying to increment specific elements by 1, in order to log results as they come in. I'm trying to read an element, add 1 to it, and then write it back to the same memory address. Why isn't this simple?
In code it would be something as simple as;
array1[element1] = (array1[element1]+1)
or
array1[element1]++
Arrays seem to be either read (indicators) or write (controls)? This is really frustrating, and there's very little help online.
Upvotes: 5
Views: 10446
Reputation: 1
As an infrequent, novice Labview user I have the same problem ... until I found the code that I used 10 years ago. Surely the answer to sgccarey is:- Right click on the array control or indicator and 'create local variable' This variable will appear on the block diagram and can be set as 'Change to Write' or 'Change to Read' as necessary to use as the input and / or output array to a simple 'replace array subset'. This way the array data only appears once on the Front Panel and is updated as required. I have no idea if using Local Variables affects runtime efficiency but it works for me. Hope this helps.
Upvotes: -2
Reputation: 305
You should use ReplaceArraySubset in the Array palette. For simple replacements, it's much faster than the In Place Element Structure
Upvotes: 4
Reputation: 59
You can use an "Array index/replace" element inside a "In place element structure":
Upvotes: 5