From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to modify file name with the press of a radio button

Hello,

 

I have a simple task that I am having some trouble completing. This is what my program is doing:

 

My VI takes 3 angles between -180 and 180 and computes the XYZ coordinate using a mathscript node. Then every time I press Trigger, the current 3 angles and their corresponding XYZ coordinate are written to a spreadsheet file.

 

 

I need to tweak the VI some more to accomplish the following:

 

The first time I select the radio button Point (or Line), I would like the spreadsheet file name to be "Point001" (or "Line001"). Then I want to press the Trigger 10 times, write to that file just created, "Point001" (or "Line001"), and after the 10th Trigger, I would like the radio button Point (or Line) to become automatically unselected.

 

The next time I select the radio button Point (or Line), I would like the spreadsheet file name to now be "Point002" (or "Line002"). Then I want to press the Trigger again for 10 times, write to that file just created, "Point002" (or "Line002"), and after the 10th Trigger, I would like the radio button Point (or Line) to become automatically unselected, again.

 

And so on...

 

Basically, I am trying to increment the filename Pointxxx each time I select the radio button. I want to write to that file 10 times, at which point the radio button Point automatically becomes unselected.


I hope it is clear to what I am trying to do. Any help would be appreciated.

 

r15


0 Kudos
Message 1 of 8
(2,544 Views)

You will need to store the values for the number of times you have pressed the trigger button, and the current number of the file in shift registers.

 

When the number of times that the trigger button has been pressed reaches 10, you can deselect the radio button (property node) and increment the file number.  Then when the radio button is pressed again, create a new file and set the number of times the trigger has been pushed to zero.

 

All of this should be done in an event structure inside of a while loop.  Your increment code should all go in the trigger value change event case and the code to reset the trigger count and open the file should go in the radio button value change event case.

Chris
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 2 of 8
(2,533 Views)

Thanks for your help Chris

I think I understood the concept you explained but I am having some trouble implementing it since I am not very familiar with shift registers.
Is it possible if you show me how its done by modifying the VI I attached previously?
Thanks again
r15
0 Kudos
Message 3 of 8
(2,518 Views)

Heres a quick modification I through together.

You should be able to tweak it more until you get your desired result.

 

Hope it helps,

Rob Afton

0 Kudos
Message 4 of 8
(2,510 Views)

I attached my working VI.

 

Now, the problem is that Trigger is saving to a different file each time as opposed to having the 10 Triggers save to one file.

 

This is what is happening now:

When I have the radio button Point (or Line) selected:

Trigger (1st time) saves to "point1" (or "line1")

Trigger (2nd time) saves to "point2" (or "line2")

Trigger (3rd time) saves to "point3" (or "line3")

....

Trigger (10th time) saves to "point10" (or "line10")

Then, Point (or Line) is deselected.


What I need is the following:

When the radio button Point (or Line) is selected

Trigger (1st time) saves to "point1" (or "line1")

 Trigger (2nd time) ALSO saves to "point1" (or "line1")

Trigger (3rd time) ALSO saves to "point1" (or "line1")

....

Trigger (10th time) saves to "point1" (or "line1")

Then, the radio button Point (or Line) is deselected.

 

Next time I select Point, I want the Triggers to write to "point2".

 

Can you fix this for me?

 

Thank you

r15 

0 Kudos
Message 5 of 8
(2,488 Views)

@r15 wrote:

I attached my working VI.


Where?

0 Kudos
Message 6 of 8
(2,486 Views)

Oops. Thanks for pointing it out.

 

Reattached it to my previous post.

 

r15

 

 

0 Kudos
Message 7 of 8
(2,482 Views)

Look at where you increment the point and line counts.  By incrementing every time you write to the files, you change the filename every time.

 

Lynn

0 Kudos
Message 8 of 8
(2,478 Views)