04-10-2024 06:32 AM
Hi All,
I am running into an issue with a 1D array of cluster of array data structure. Sadly I cant upload working code as its written in actor framework and divided over multiple actors.
We came up with a data frame which is a (1D array of cluster), which has all the elements required for data acquisition and analysis.
I am trying to populate Y-Data and X-Data array only. Approach taken is given below:
Test counter will run from 0-4 and resets back to 0. This increments port number to +1 and the process repeat again until the port goes above 17, when the actor completes execution.
I am trying to populate All Data array for counters 0-4 which should go into index 0 for port 1, when port increments to index 1 which is port 2, I want index 1 of all data array to be populated.
When I use build array or insert into array functions, on each test counter increment data is added to the index, based on port number, so for port 1 which is 0 index, my all data array has five entries governed by the test counter. When port goes to +1 i get another 5 entries and so on.
Using replace array subset does not populate the array as I thought and it comes back empty. I believe I need to initialize the array first to use this function, which I cant seem to figure out as incoming data is an array. Has anyone run into a similar problem or can provide a useful insight? I have attached a VI which is performing a similar task. I will appreciate any help. Best Regards
Solved! Go to Solution.
04-10-2024 01:56 PM
What do you expect if you index into an empty array?
You probably want to initialize an array with default values if the correct final size, then use the IPE to update elements based on port number. You cannot insert into a position that does not exist, unless you are at the end of the existing array.
04-10-2024 02:06 PM
See if this can give you some idea about data manipulation. Of course you need to incorporate it into your own code where the data is only added when needed.
04-10-2024 04:27 PM
The attached malleable VI will let you place items in an array without initializing it.
It pads the array as needed with default values.
04-18-2024 03:31 AM
Thanks for replying. I have used a similar approach where I initialize array for the number of ports before replacing data based on index number.
It works for this approach as I already know before hand the amount data I am expecting.
Thanks again for all your help