LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why the output file is so big?

Dear All,
         I am trying to write some data to the binary file. But the output file is very big. When I write 1M*4kB ,the file will more than 20MB. I don't know why.
        This is my vi, Please help me to find the fault,OK? Thank you very much.
        Thanks.
0 Kudos
Message 1 of 9
(3,816 Views)
Every time you run the program, you append to the same file. The file will be larger than you might think If you run the program more than once.
Message 2 of 9
(3,810 Views)
I have wire 2 to the function port of the open vi. Does it mean that it will replace the file if it exists, and I have found that the size of file will be different if I choose different length, not larger than before.
What do you think of?
Thank you.
0 Kudos
Message 3 of 9
(3,801 Views)
Oh, sorry. Yes that should replace the file.
 
Some advice: To make the diagram more redable you should not wire plain numeric diagram constants. Please delete the "2" and right-click on the terminal, then select "create constant". Now you get a nice ring with obvious labels. 🙂
 

 
There is no way to tell how much data you are creating. How big are the arrays coming out of the subVI? If your files is 20MB, most likely you are actually wrting 5M I32 points.

Message Edited by altenbach on 08-02-2006 07:19 AM

Message 4 of 9
(3,773 Views)

Oh,Thanks.

Compare to write a I32 constant to a file,  writing a array which only contain one I32 component. Is the size of file the same?

Writing a array of 1M I32 to the file. How big will it be?

Thanks.

0 Kudos
Message 5 of 9
(3,746 Views)
Well, in the time it took to write your question, you could have just done the experiment yourself. 😉
 
Write I32 constant: 4bytes
Write I32 array with one element: 4 bytes
Write I32 array with 1000000 elements: 4000000 bytes
 
(In the last two cases, the size will be larger by 4 bytes (8 bytes, 4000004 bytes resp.) if you enable the header option, which you don't).
 
 
 
 
 

Message Edited by altenbach on 08-03-2006 06:37 AM

Message 6 of 9
(3,729 Views)
Thank you for your reply.
But why running the same vi, I get the different result?
Thanks.
0 Kudos
Message 7 of 9
(3,712 Views)

It is NOT the same vi!!! You need to familiarize yourself with dataflow, LabVIEW does NOT execute left to right, any part can execute if all inputs have data.

In your particular case, the "file info" will execute at the same time you are building the file path. In addition, you are measuring the size of the stripped path and not of the new file. Try execution highlighting!

To fix your code:

  1. You need to get the "file info" from the path AFTER you add the new filename.
  2. Use the error cluster to enforce proper execution order as in my example. WIre the error out of "close" to the error in of "File info". Now the "File info" must wait until all inputs have data, which can only happen after "close" has completed.

All clear? 😄

Message 8 of 9
(3,699 Views)
Oh, I understand. Thank you altenbach.:)
0 Kudos
Message 9 of 9
(3,677 Views)