LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

build path from string control

Solved!
Go to solution

@TSCline wrote:

I am still learning labview as quickly as I can so thanks for the feedback. I don't understand why you call it a path constant called string. It's pink and appears as a string constant on the front panel.


 

Message 11 of 29
(2,313 Views)

Here is the original path constant, then the string control, and then the path as it enters the open/create/replace function

0 Kudos
Message 12 of 29
(2,312 Views)

@TSCline wrote:

Yes the result in the error is exactly what it should be. All the string control contains is the number 1. 

 

What I am trying to do is update a file. I collect data periodically and want to add the contents into a file. right now it essentially replace the old file with a new one of the same name. Since I store the data in the array it accomplishes what I want but in a poor way. What is the best way to add data onto an existing file. Do I need to open it, read it into an array and then add onto it? Your help is very appreciated


Are you sure there are not any control characters (none printing) in the path?

Show us the resulting value of the path.

 

If you open the file once and keep it open, each write will append data to the end.

But if you open the file, write some data and then close it and if you re-open the file you will need to set the file position to the end of the file to append new data to it. Other wise it will over write the old data with new data starting at the beginning.

Omar
Message 13 of 29
(2,311 Views)

sorry sorry sorry it looks like i sent the wrong picture

0 Kudos
Message 14 of 29
(2,308 Views)

do you just use the close file function outside the while loop with close excecution? or with the the other way what function is used to set the file position?

0 Kudos
Message 15 of 29
(2,299 Views)

What is the correct path supposed to be? Is there supposed to be a space between "December 20" and "Water Vapor", or is "Water Vapor" suppose to be a sub-directory? Is there supposed to be a space before "1"? If those are supposed to be subdirectories, you appear to be making the classic mistake of trying to use string operations to create paths. That's why you should be using the file functions to build paths, not string concatenation functions.

 


@TSCline wrote:

What I am trying to do is update a file. I collect data periodically and want to add the contents into a file. right now it essentially replace the old file with a new one of the same name. Since I store the data in the array it accomplishes what I want but in a poor way. What is the best way to add data onto an existing file. Do I need to open it, read it into an array and then add onto it? Your help is very appreciated


Why not just use the Write to Spreadsheet File VI? It has an "append" input.

Message 16 of 29
(2,299 Views)

i didn't know about the append input on the write to spreadsheet file. That will work best for me. Thank you

0 Kudos
Message 17 of 29
(2,295 Views)
Solution
Accepted by topic author TSCline

 

You are creating a folder that looks something like

 

"C:\Users\Hansen Group\Dropbox\HEP Self-Reaction\December 2011\December 20" inside the Create New Path subVI

 

So I think your file path should look something like

 

C:\Users\Hansen Group\Dropbox\HEP Self-Reaction\December 2011\December 20\Water Vapor Concentrations1

 

I think you are missing the '\' before "Water Vapor Concentrations1"

 

From your last post I see the problem. the Create New Path VI is creating a new folder or directory and not a data file.

Then when you try to open the directory as a file to write data to it, a directory is an invalid file type. A directory is a directory and not a file that you can write to.

 

 

 

 

Omar
0 Kudos
Message 18 of 29
(2,290 Views)

Hi, 

Sorry for the intrusion

I have a problem with an append path from the "build path" function.

Built the path, it enter in "list folder" function but does not pass through the tunnel of the for loop.

Instead, if I wire a path controll to the "list folder", the path pass through the tunnel and the vi run as it should.

I attach the image of my VI so you understand better.

Please... Help me! 

0 Kudos
Message 19 of 29
(2,103 Views)

gmazza,

 

What does 'List folder.vi' return at the 'path out' terminal then?

0 Kudos
Message 20 of 29
(2,094 Views)