08-18-2010 11:46 PM
08-19-2010 04:01 AM
Hi LabVIEW guys,
I am a new bie for labVIEW.
I tried to write the solution for this question... Please throw your comments and feed backs on my source code..
help me on optimization on this code:
i want to merge bot the for loops used in my code in to a single loop. But i felt little tough to do this task.
please provide the information or clues to do this
To improve labVIEW coding style, please give me suggestions.... Thank you.
08-19-2010 05:01 AM
@Electro SAM
thank you very much.i have tried alot for it.i am really thankful to you.
thanks for all who gave me their valuable tips and replies.
08-19-2010 06:22 AM
@Electro SAM
what u have posted is working properly,but cant we do it without ' Typedef ' ? and in your vi if "NA" is present at Controller1 and any channel is chosen from controller2 , the chosen channel from controller2 is disabled in controller1, which should not happen. in the corresponding controllers only it should get disabled (i.e from controller 3 to 8).
08-19-2010 07:19 AM
mohansagar,
It could be done without making the enum a typedef, but using the typedef is the preferred way. By using a typedef you are assured that all the controls are identical. If you need to change or add an item, you only need to change the typedef and all the controls and constants derived from it are automatically changed. For your present application this may not be a big factor, but when an enum is used for the state of a state machine, changes often occur and this becomes very valuable.
ElectroSAM,
Nicely done. You should wire the error in to the error out in the Error case so that whatever error occurred will be passed to the output. The Use Default if Unwired option on case structures should be used with great caution. Many experienced LV programmers prefer to turn that option off. The only place I routinely use it is (as you did) i the Stop: Value Changed case of an event structure.
Another way to get the enum references is to take a reference to the Input Cluster followed by a property node to obtain the array of references to the controls within the cluster. You need to a To More Specific Class function to get access to the enum properties. This is not necessarily better, just another tool. It can be extended to gain access to any control on the panel. Search for Ben's Nugget on control references for much more information.
Lynn
08-19-2010 10:41 AM
@mohansagar wrote:
@tbob Thanks for the reply.... but can u please down convert it into Labview 9 or Labview 8.5. i am not using Labview 10. i could not open the Vi.
Here it is in 8.5
08-19-2010 10:43 AM
@electro SAM wrote:
Hi LabVIEW guys,
I am a new bie for labVIEW.
I tried to write the solution for this question...
Wow. You must have been reading my mind. Your solution is very close to the solution I posted back on page 1.
08-19-2010 10:43 AM - edited 08-19-2010 10:44 AM
@electro SAM wrote:
Hi LabVIEW guys,
I am a new bie for labVIEW.
I tried to write the solution for this question...
Wow. You must have been reading my mind. Your solution is very close to the solution I posted back on page 1.
Ooops, double post.
08-19-2010 01:39 PM
Two spaces after a period was a typewriter thing. Most modern word processors take care of the spacing after a period for you.
08-22-2010 10:34 PM
@mohansagar wrote:
@electro SAM
what u have posted is working properly,but cant we do it without ' Typedef ' ? and in your vi if "NA" is present at Controller1 and any channel is chosen from controller2 , the chosen channel from controller2 is disabled in controller1, which should not happen. in the corresponding controllers only it should get disabled (i.e from controller 3 to 8).
Hi guys,
I can't get your requirement... According to your quote, I alter the code.
But if you change any of your values in the front panel in decending order, it will work. But if it is in ascending order, your controls won't get disable.
And one more possibility is also there, the user can choose a same option more than one time in ascending order (but not in the decending order).
It will lead the program in wrong.
Check it out...
<<May be my code have error, check my code with your requirement>>