12-23-2014 12:39 PM
Hi
I have an array as a "Control" in my code and need to have a notifiication which notifies me when any components of the array changes. Moreover I need to know the index of the changed component or components.
How Can I accomplish this?
Regards
V. S
12-23-2014 12:45 PM - edited 12-23-2014 12:49 PM
Since it is a control, are you looking for changes by the user or for programmatic changes?
For changes by the user, just use a value changed event and compare the old vs. the new value with a "not equal" comparison (from the event data node). Do a boolean to 0,1 on the comparison result followed by array min&max*. The max indices will give you the indices of the changed element.
For programmatic changes, things get more complicated because more than one element can possily change.
(* note that things could be made simpler with this idea implemented)
12-24-2014 07:17 AM
It may be not a control.
I can prepare a code by myself to do that, but I wanted to know if there is any block in labview which can do this task or not.
Regards
12-24-2014 10:49 AM - edited 12-24-2014 11:58 AM
@V.S wrote:
It may be not a control.
I can prepare a code by myself to do that, but I wanted to know if there is any block in labview which can do this task or not.
You need to be much more specific. What is "that"? What is "this task"? What is a "block"? You use the words array and matrix interchangeably, but they are not the same.
Earlier you talked about a "notification". This word has a very special meaning in LabVIEW, but it seemed you were using the term generically. Should the program notify the user (e.g. with a popup or other message), or should e.g. other parts execute in response?
As I said, if there are programmatic changes of the array, more than one element can change at once, so there might not be a single changed element. What kind of "notification" are you expecting in this case (e.g. a list of all change elements).
Monitoring generic changes in a data structure is typically done with a shift register or feedback node, comparing the current value with the value from the previous iteration of the loop. Any differences will point out the changed parts.
Once you attach a simplified VI showing what you are trying to do, we can probably help very quickly. At the moment, your descriptions are way too vague and ambiguous. Thanks!
12-24-2014 11:53 AM
@V.S wrote:
It may be not a control.
I can prepare a code by myself to do that, but I wanted to know if there is any block in labview which can do this task or not.
Regards
If you can prepare code to do it yourself, you should have spent some time in either the palette with the functions related to what you're doing or searched for what you want in Quick Drop. If you haven't found an Express VI to do this very specific case that has multiple possible expectations, it either doesn't exist or I doubt you've spent the time you suggest. This is trivial enough I wouldn't expect to find an Express VI to handle it for you.
12-24-2014 03:44 PM
Dear Friend
I found the answer from your explanation.
I should prepare a code using feedback node and compare every element of the array with its previous value.
Thanks alot