LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write data to multiple text files after specific size

Hey swap15, 

 

I guess, performance could be the drawback.

 

From the LabVIEW Help: 

(http://zone.ni.com/reference/en-XX/help/371361J-01/lvconcepts/using_advanced_file_io/)

 

Disk Streaming

You also can use File I/O functions for disk streaming operations, which save memory resources by reducing the number of times the function interacts with the operating system to open and close the file. Disk streaming is a technique for keeping files open while you perform multiple write operations, for example, within a loop.

Wiring a path control or a constant to the Write to Text File function, the Write to Binary File function, or the Write To Spreadsheet File VI adds the overhead of opening and closing the file each time the function or VI executes. VIs can be more efficient if you avoid opening and closing the same files frequently.

To create a typical disk-streaming operation, place the Open/Create/Replace File function before a loop, the read or write function in the loop, and the Close File function after the loop so continuous writing to a file can occur within the loop without the overhead associated with opening and closing the file in each iteration.

Disk streaming is ideal in lengthy data acquisition operations where speed is critical. You can write data continuously to a file while acquisition is still in progress.....

 

 

In addition I would avoid the variable x+1. You could shift the value through the while-loop, this would avoid the feedback node too.

The selector wired to the case selector is indeed redundant.

 

And one final question:

What happens with the file reference if you shut down your program?

Closed or not?

 

 

 

 

Regards,

CMW..

 

 

 

0 Kudos
Message 11 of 16
(547 Views)

hey,

 

thanks for the info. No,  the file reference is not closed.

 

Just for your info:

 

My main purpose is I am using this code (complete code as shown in previously attached pic) for simultaneously acquiring data from 10 sensors and logging resective data in individual files. So each sensor will have seperate file name appended with 0,1,2...and so after a specific file size.

0 Kudos
Message 12 of 16
(539 Views)

Hey swap,

 

I know your purpose from you previous Post. Smiley Happy

 

http://forums.ni.com/t5/Automotive-and-Embedded-Networks/Reading-CAN-frames-from-10-sensors-Simultan...

 

Regards,

CMW

 

0 Kudos
Message 13 of 16
(531 Views)

OK, so I am going to ask....

Why code this at all when Write to measurements file express vi coded it for you?

Capture.PNG


"Should be" isn't "Is" -Jay
0 Kudos
Message 14 of 16
(520 Views)

That's a good question....

...the point is, I don't like Express VIs. (even if they have the right to exist)

0 Kudos
Message 15 of 16
(517 Views)

@CMW.. wrote:

That's a good question....

...the point is, I don't like Express VIs. (even if they have the right to exist)


Niether do I .... for the most part.  Write to measurement file and Elapsed time do pretty good jobs though!  Express vi.s are not evil. Those two in particular will find themselves on my block diagrams now and then when warented.


"Should be" isn't "Is" -Jay
0 Kudos
Message 16 of 16
(510 Views)