LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

appending data to the same text file

Hu GerdW

attached is my VI

thnaks

Maple

0 Kudos
Message 11 of 17
(1,104 Views)

Hi Maple,

Maybe this example will help more:

(Sorry for the incomplete block diagram earlier...)

 

Message Edited by Charlie S. on 08-21-2006 05:21 PM

Charlie S.

Visit ni.com/gettingstarted for step-by-step help in setting up your system
Message 12 of 17
(1,091 Views)

Dear Charlie

thnaks for your help , I tried this VI it writes binary numbers while my VI is for text numbers , could u take a look at my VI and see how to solve the  problem of asking for a text file will it create a text file or I need to do so and choose the path before I run the VI

Thanks so much

appriceited Maple72

0 Kudos
Message 13 of 17
(1,083 Views)
Hi Maple,
first of all, your outer while-loop runs twice (if the conditional terminal gets a TRUE in your case, all code in the loop will be executed once again), so you open the file two times without closing it. For the same reason the inner loop runs 151 times.
The second thing I see is that writing the headline to the file "Distance 10cm..." (btw. you can write all this into one string constant) executes logically at the same time as the inner loop. Certainly it will be executed before the "write to text file" in the inner loop, but because you didn't force it by wiring the data flow you have no guarantee.
My guess is to remove the outer while loop, it has no function, and the program is closer to what you need.
Greets, Dave
Greets, Dave
0 Kudos
Message 14 of 17
(1,067 Views)
Hi Maple,
 
I'm happy to help out! Smiley Happy I agree with the suggestions that Dave made. There were some subvi's missing in your code, so it's hard to tell what you're doing with the nested while loops. Also, it's generally good programming practice not to branch you file refnum to two parallel write VI's, as there's no guarantee in what order they will execute. If the dialog prompt is bothering you, you can turn it off like so (advisory dialog input):
 
 
Hope this helps!

Message Edited by Charlie S. on 08-22-2006 09:56 AM

Charlie S.

Visit ni.com/gettingstarted for step-by-step help in setting up your system
0 Kudos
Message 15 of 17
(1,056 Views)

Hi charlie,

did this but it didnt help?, it still asks where is the file path to  save the data on, doesnt it create automatically a txt file and save data on it?

Thanks

Maple

0 Kudos
Message 16 of 17
(1,044 Views)
Hi maple,
I made some modifications on your VI and send it back. I removed the outer while loop and cleaned a bit the left part of the diagram. It looks as shown below. If you wire the path control to the "open/create/replace" it doesn't prompt you for a file but you have to specify a valid filename. If it isn't wired, the VI prompts on every start of the VI.



Greets, Dave

Message Edited by daveTW on 08-23-2006 12:04 PM

Greets, Dave
Download All
Message 17 of 17
(1,024 Views)