LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Progress indicator FileToArray and ArrayToFile

Hello,
 
At the moment I'm acquiring large amounts of data (100's of Mb's to some Gigs), storing it in binary format, and converting it to ascii in a later stage.
Because the files I use to store data are quite large, the conversion (using FileToArray and ArrayToFile) takes very long.
Is it possible to implement a progress indicator/bar for these functions?
 
Best regards,
Ward Jennekens
0 Kudos
Message 1 of 3
(3,936 Views)
As fas ar I know, ArrayToFile function is a built-in one that is not possibile to interrupt in order to get the progress of the function nor is possible to interrupt if needed.
 
If you really need to give the operator a feedback of function behaviour you need to develop your own function to translate data from binary to ascii format with a loop into which you can add a progress bar indicator and a stop function (for example using the ProgressDIalogue functions in the Programmer's Toolbox).
 
You could also use ArrayToFile in a loop segmenting the array of data in chunks and monitoring the process, but with very large sets of data (that means a lot of execution of this function) the overhead due to continuous opening and closing of the file may raise execution time too much. Anyway, you could organize this function as follows:
 
do {
 r = ArrayToFile ("myfile.txt", array, VAL_DOUBLE, 1000, 5,
    VAL_GROUPS_TOGETHER, VAL_GROUPS_AS_COLUMNS,
    VAL_SEP_BY_TAB, 10, VAL_ASCII, VAL_APPEND);
 if (r < 0) break;
 // Test for stop condition
 if (stopCondition) break;
} while (!r);
if (r < 0) {
 // Warn the operator in case of errors
 if (r > -3) {
  r = GetFmtIOError ();
  sprintf (msg, "Error %d received: %s.", r, GetFmtIOErrorString ());
 }
 else
  sprintf (msg, "Error %d received.", r);
 MessagePopup ("Severe error", msg);
}


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 3
(3,929 Views)

Dear mr. Bozzolo,

thank you very much for your fast response! Your solution works fine for me.

Best regards,

Ward Jennekens

0 Kudos
Message 3 of 3
(3,922 Views)