LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

control array of cluster

I understand Neos.. Appreciate that..

 

Some how i had lost a nerve... everybody has a bad day ,...

Regards
Guru (CLA)
0 Kudos
Message 21 of 22
(353 Views)

Hello Keremgeliz

 

Some tips that would improve your code

 

1> get rid of the outer while loop.. it wont do any good. You may already experienced that you need to hit press the "Abort execution" button to stop the vi from running

2> Create an event for the "exit or the cancel" button and wire a "True" constant to stop the whie loop (inner whie loop) which will also stop the program whie hitting the stop or cancel button

3> Since all your code is in the event structure for every FP action, it may difficult for you to manage the code over a period of time.So hence it could a be good time to move the logic part of the code to some other state. I would recommecnt you to modify the code to have a state machin architecture (I personally prefer Queue based state machine with event structure for handling the FP activities)

4> Keep a ini file or some sort of initialization file to keep all the "file paths" you have used and load them every time you start the program. This wouls also make the distribution of the code easier.

5>Have a seperate state to update the controls in the UI so that you will end up using a single local variable through out your project

6> initialize your shift register and use shift registers to pass the data between multiple state of the state machine.

7> you also dont need the time out case wired to the event case. Infact you can delete this event case if you are not using it.

 

 

So the real question why the entire cluster valus changes when you change any one value

 its because of the for loop ( auto indexed) and the subvi that calculates the value for each and evrry iteration of the loop and updates the property node after the loop iteration. 

 

To get rid of this probably you can compare the "new value" with the "old value" index by index so that you get to know the index of the row which has changed. Then use the "index array" to get the particular row , then calculate the new value and bundle it back. Use the "replace array subset" to update this new valus (as you already know the index which needs to be updated)

  or any other logic with which you are comfortable with...Hope it helps..

Regards
Guru (CLA)
0 Kudos
Message 22 of 22
(341 Views)