07-15-2014 01:26 PM
Hi everyone,
I have an event structure were it contains four events. All the four events has separate buttons to execute. Here, three events will generate numeric output, remaining one event (Finder) should find the order of those three events. For example, Three events namely A, B and C. I execute the events in the order of B, C and A. The finder event should find the order of previously executed events(B, C and A).
Thanks in advance.
Solved! Go to Solution.
07-15-2014 01:27 PM - edited 07-15-2014 01:28 PM
07-15-2014 02:16 PM
If you want a list of sequences since the VI started running, make sure this event passes the shift register through un-altered. If you want to know the sequence since previous "Finder" event was run, then make sure to clear it after it's read (pass an empty constant to the shift register).
Alternatively, you can do both (two shift registers) using the same event.
As far as the contents of the shift register, you could easily use an array, using the Build Array Function, or you could use a string constant, using Concatenate String to build the contents.
07-15-2014 02:16 PM
Use an array of three number is a shift register and initiaize it with NaN values. In each event case, substitute the relevant element with the actual value. before the event structure, use a case structure that goes true when all elements of the array are no longer NaN and do the recalculation there, for example.
There are many other ways to do this.
Can A, B or C change again later? My code would simply recalculate whenever all three values have been changed at least once.
07-15-2014 04:48 PM
As mentioned, there are numerous ways to do something like this in LabVIEW. Can you tell us about the application you need this functionality for?
If it's a school assignment please post the code you have attempted and we can help you work through it.
07-16-2014 10:53 AM - edited 07-16-2014 10:55 AM
Hi everyone,
I am happy for all your replies and these are more effective solutions. Actually I forgot to add some information in my query. Kindly refer the attached VI. (This is not the actually VI that I am working with. Its just an idea of original VI).
From the suggested solution, I have a new problems.
- There is a timeout event at the start up and it will keep on execute in a while loop. If I connect an array in shift register and It will produce a zero value at the finder event.
- Once I read the order of sequence in the Finder event, It should reset the all the sequence values inorder to store for next different sets of sequence.
07-16-2014 10:55 AM
07-16-2014 10:56 AM
@altenbach wrote:
Vij@y wrote:
Kindly refer the attached VI.
I don't see it!
Well now u can !
07-16-2014 11:13 AM - edited 07-16-2014 11:14 AM
Why are you constantly firing the timeout event?
This VI seems quite unrelated to the originally discussed problem.
07-16-2014 12:32 PM
Hello Vij@y,
I could not look in to your VI because I dont have LabVIEW 2013 (I have 2010) but i tried to understand the situation you are explaining.
Please find attached image of front panel I made for your reference.
Here I generated two events sequently, no 3 first followed by no 1 and the same is displayed in sequence array. now you can use the build array function to actually add each event to this array as explained by many people in this forum.
regarding the timeout event, either you can display the sequencer array in that event or you can display it in finder event and then you can reset the sequencer in finder event (I used reset button click event to reset sequencer back to zero value)
regarding getting zero when you press finder/reset button before triggring any other event:- Is it not correct to have empty array when you have not trigger any event?
I hope I put it well and may help you to find solution.