LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Run Number Logic

Solved!
Go to solution

Hi everyone,

 

I have a program that runs a DC and AC test. I want to label each run by a number, which I call run number, and which I want to save in a file along with the data taken. i tried to implement this by adding to my program the code attached to this email. In the path string I want to put the name of the file where I will save the data. How can I "tell" the program to get the name of the file from the last run?

Also, is this a good way of doing it or does anyone have a better way of implementing this?

 

Thank you,

Christian

 

Message 1 of 13
(3,972 Views)

Very simple... if you just add a little bit of code, that will do it.  When you want your VI to take name from the last run, don't enter anything through path input and it will use last path. When you want a new path, simply supply that.

 

 

AutoName.png

 

-BTC

--------------------------------------------------------

New Controls & Indicators made using vector graphics & animations? Click below for Pebbles UI


Message 2 of 13
(3,962 Views)

Thank you. I tried it, but if I don't give it an input in the path string, it gives me an error saying that the path is either empty or relative.

 

Christian

0 Kudos
Message 3 of 13
(3,947 Views)

@christianwos wrote:

Thank you. I tried it, but if I don't give it an input in the path string, it gives me an error saying that the path is either empty or relative.

 

Christian


Sounds like you're entering a filename that does not exist...  or maybe you switched wires in "Select" function?  Also, are you stopping and then restarting the VI for each filename? (If so, that may require a bit different code)

 

-BTC

--------------------------------------------------------

New Controls & Indicators made using vector graphics & animations? Click below for Pebbles UI


Message 4 of 13
(3,942 Views)

- Sounds like you're entering a filename that does not exist...  or maybe you switched wires in "Select" function?

 

No, I wired the select function just like you did.

 

- Also, are you stopping and then restarting the VI for each filename? (If so, that may require a bit different code)

 

Well, I don't really stop the VI. The VI jus stops automatically when the test is over. I am not sure whether that makes a difference or not. If you don't mind, I attached the VI to this message. I was working on the run number logic separately, before adding it to the main VI. I am not sure where to place it in the main VI, though.

 

 

Thanks again,

Christian

0 Kudos
Message 5 of 13
(3,936 Views)

@christianwos wrote:

- Sounds like you're entering a filename that does not exist...  or maybe you switched wires in "Select" function?

 

No, I wired the select function just like you did.

 

- Also, are you stopping and then restarting the VI for each filename? (If so, that may require a bit different code)

 Well, I don't really stop the VI. The VI jus stops automatically when the test is over. I am not sure whether that makes a difference or not. If you don't mind, I attached te VI to this message. I was working on the run number logic separately, before adding it to the main VI. I am not sure where to place it in the main VI, though.

 

 

Thanks again,

Christian


Ah, I see. Your VI essentially goes through that state machine and then ends so I'm guessing that for the next run you're running the VI again. (essentially you're restarting the VI and you want next run of the VI to remember filename from last run).

 

You could save filename in a text file and read back in the next run, otherwise I don't believe there is any guarantee that last run name will be retained in that VI. Please check the following images (true/false case in each):

 

AutoName2.png

AutoName3.png

 

Please note that above logic is a bit raw, it may require you to add error-handling/etc.  Hope that helps!

-BTC

--------------------------------------------------------

New Controls & Indicators made using vector graphics & animations? Click below for Pebbles UI


Message 6 of 13
(3,921 Views)

Thank you so much for all your help. I will try it and let you know if it works.

 

Christian

0 Kudos
Message 7 of 13
(3,908 Views)

I would have thought that if you were going to be working in a single folder you could also take the last edited item to be the last file.

Last File.png

Message 8 of 13
(3,896 Views)

Sorry to bother again, but now the VI gives me a different error. When I run it it says that an error occurred at the "Scan From String" funtion. The error is: "Scan failed. The input string does not contain data in the expected format." But I am using an I32 as sink and the format should be %d, shouldn't it?

 

- Christian

 

0 Kudos
Message 9 of 13
(3,831 Views)

Hi Christian,

 

Try using %s as the format for the Scan From String function.

 

If I understand the situation correctly, you should be reading in a String value in the Scan From String function "input string" node. 

 

Regards,

Daniel

Daniel Parrott
Software Product Marketing - Data Management & LabVIEW
National Instruments
Message 10 of 13
(3,768 Views)