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.
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.
07-27-2016 10:59 AM
Hi, I have an experiment which need macro data to be saved and I am currently trying to store all this in a cluster which itself will contain clusters and arrays. I have an array of clusters with in a cluster and i want to update the cluster. the code below shows how i do that. basically i pick out the array, index it to get a ref to the cluster, write values and then insert cluster back to the array index. but it doesn't work. Its such a simple problem I'm a little stumped. Any feedback would be great.
thanks
07-27-2016 11:04 AM
There's missing typedefs. Do Save As -> duplicate hierarchy and upload a zip of that folder instead.
07-27-2016 11:08 AM
You can only replace elements if they exist. That is, if the element you are replacing is empty, it will still be empty after you use the replace function. Try initializing your array first.
Also, no need to unbundle the items in your cluster that are not being used/modified.
07-27-2016 11:09 AM - edited 07-27-2016 11:10 AM
Hi Stephen,
after getting rid of all those missing typedefinitions I could run your VI and it worked as expected (I think so)…
but it doesn't work. Any feedback would be great.
Well, saying "it does not work" is a bad error description. It's a very bad description. Enough feedback? 😄
i pick out the array, index it to get a ref to the cluster, write values and then insert cluster back to the array index.
Does the element you want to index even exist? You cannot replace non-existing array elements!
07-27-2016 11:14 AM - edited 07-27-2016 11:16 AM
To edit an existing array element, you need to put it back using "replace array subset". You are using "insert into array, which would grow the array by one element, leaving the old data intact.
Have a look at the "in place element structure", it can simplify some of your code.
(there is no need to attach the typedef, we can just disconnect from it).
07-28-2016 04:25 AM
By doesn't work I mean that the element that i wish to be inserted into the index does not go. Also the array element may be both populated and not. I need to write it the first time but then may need to update it in the future.
07-28-2016 04:33 AM
The program worked when the index is 0 but then when i increase it to 1 or higher the element in index 0 will revert to default and so is the element in the index i selected. I need this aray to be 4 element in length and then write to each element depending on what experiment has been run.
Regarding initialising the array how would i do this? The array is part of a type def cluster and so I dont know were I would use the initialise array function.
also I have attached the vi where the type defs shoudl work.
Thanks
07-28-2016 04:47 AM
07-28-2016 04:50 AM
When I use the replace array subset this doesn't work either. I will look into the in place elemnet structure you suggested though but I've never come across this so it is all new to me.
thanks
07-28-2016 05:10 AM
Okay, I'm not understanding this. I have already initialised the array in the the type def when I made it, haven't I?