LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

different name depending on case structure

Within my program (timer001.vi), I'm trying to have various cases controlled by a radio button, and I'm trying to have a different file name depending on the case structure. Everything works as expected except the circled part (circled.jpg). When run, right now, the '...numbers' file never even gets saved.

 

Could anyone tell me what I'm doing wrong and how I should fix it?

Download All
0 Kudos
Message 1 of 6
(3,176 Views)

I couldn't find an 'edit' so I'm just replying to this...

 

I'd like to add that if I drag the 'C:\Documents and Settings\inst\Desktop\testing\numbers' string outside the case structure, then everything works as expected. However, if I do that, then I won't be able to change the path location depending on the case structure.

0 Kudos
Message 2 of 6
(3,172 Views)

In a nutshell, you have two cases that never finish executing, they have loops that run forever in them.

 

 

Without going into comments on cleaning up a lot of other issues in the code, what you need to do is wire your case selector to a different case structure with the file name/path or whatever that string is in it.

Message Edited by PJS on 11-21-2009 06:38 PM
Message Edited by Support on 11-23-2009 08:54 AM

Paul
Download All
0 Kudos
Message 3 of 6
(3,155 Views)

I don't see how you expect it to work. The only cases with something wired have while loops that you cannot stop exept with the Abort button. The Abort is going to stop everything. Do NOT wire a constant to a while loop's termination terminal.

 

p.s. Why are you using the obsolete traditional DAQ driver? Using multiple instances of them does not make any sense either.

 

And while you are at it and making modifications, please clean up your wiring. What you have in the 'Selection 2' case is unreadable.

0 Kudos
Message 4 of 6
(3,147 Views)

That VI needs to torn down and rewritten fron scratch. This thing is buggier than a formicarium.

 First you need to learn some of the basics of dataflow.

 

  • You have three loops with data dependency, and each containing an event structure. This means if any of the buttons is pressed out of order, your VI locks up forever.
  • This is a toplevel VI, but there seems to be no toplevel while loop. Are you using "run continously"??
  • Never operate on paths as strings. Use path datatypes and use build path/strip path instead.
  • You have many duplicate strings in the various cases. They belong before the case structure so you need only one each.
  • Duplicate strings cause errors and make the code unmaintanable. For example if you need to make one small change, you need to do it in several places, breaking the code if you acidentally forget one location.
  • Incredible amounts of duplicate code, e.g. the code in selection 3 could be made with a FOR loop autoindexing over an array of string, and with a single instance of the file IO. Most likely, you don't have a high performace disk array with 8 drives that can read all files in parallel anyway. 😉
  • Use good labels for the elements of a radiobutton control, for example use the boolean text as label and hide the label. This will make the code much more readable because it correctly labels the cases.
  • As others have mentioned, many of your loops cannot be stopped.
  • under "selection 3", you get an illegal filename after the case structure due to "use default if unwired".
  • You should design your front panel for a resonable monitor. Not everybody has 36 inches diagonally.
0 Kudos
Message 5 of 6
(3,141 Views)

Looking at the three loops at the bottom of your code I suppose you're making a reaction time measuring program (what's in a name???).

Also the user should press the buttons in the correct order, 1 then 2 then 3 then 4.

(That's why he has a 36" monitor Altenbach 🙂 the further the buttons away from each other the better.)

 

If that is the case please take a look at the attached VI "4Buttons".

I use the "Disable" propery to control to correct order of the buttons. There is only one button enabled at the time.

When the user press the correct button, the next one is enabled and the actual one is disabled.

I store the time each button is pressed into a control.

Once the complete cycle is done, just subtract the controls from each other to get the time between 2 buttons.

 

Everything is in one loop and an event structure.

Use the same event structure to capture your radio buttons, I already prepared some code, up to you to fill the cases with the correct "clean" code.

 

0 Kudos
Message 6 of 6
(3,097 Views)