From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

file path

 

 Hello, I wanted to create a file where its name is written during simulation and always with the date and time. I tried to add the "open / create a file" and instead of putting a path in command I put a concatenated string consisting of the date and time and a command string where I will write The name and then I converted this string to path but I still have a 1430 error. But also I wanted to choose the file type (.txt or .csv) during simulation.

0 Kudos
Message 1 of 11
(3,235 Views)

Show us your code so we can figure out what you did wrong.  Generally, you should be using the Build Path to create the path for your file.  In your instance, it sounds like you provided an incomplete path.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 11
(3,211 Views)

this is my code

0 Kudos
Message 3 of 11
(3,179 Views)

example-write-to-file.png

 


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
Message 4 of 11
(3,173 Views)

sam2017 a écrit :

this is my code


There is a pretty obvious race condition in your code. Nothing prevent the sequence at the right to be executed before the code at the left. In this case the File To Save local variable would not have been written by the code at the left resulting in error 1430.

 

Ben64

Message 5 of 11
(3,169 Views)

@sam2017 wrote:

this is my code


There is a small issue in your VI. There are no delimiters between the values that you write to file. I like to use "Format Into String" rather than using multiple Number/String Conversions. It looks cleaner. I'm assuming you are writing a CSV file with comma delimiters.

 

screen.JPG

 

Format into string.png

Message 6 of 11
(3,148 Views)

thanks for your help but i still have some issue.

when i excute the program the file's name become  for example " 2017_06_15_14_42_29_test.txt"

but when i rexcute it a new file is created and its name  becomes " 2017_06_15_14_42_50_2017_06_15_14_42_29_test.txt"

when ever i rexcute  the present date will be added to the previous file name.

otherwise i need a new file to be created with a new name and date.

0 Kudos
Message 7 of 11
(3,127 Views)

because, from the original file-path,

the directory is extracted and the filename,

which is then prepended with the date.

if you select a file as input, that has already a date in the name, the new date will be prepended.

 

just hardcode the file-name suffix in your vi


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 8 of 11
(3,123 Views)

how can i do it ?

can you help me with that?

0 Kudos
Message 9 of 11
(3,109 Views)

@sam2017 wrote:

how can i do it ?

can you help me with that?


Just get rid of the "chemin" local variable and your previous data/time will not be part of the file name.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 11
(3,103 Views)