02-20-2006 09:30 AM
02-20-2006 11:14 AM - edited 02-20-2006 11:14 AM
Supposing in LabVIEW you are using Write to SGL file.vi, you can read back your data into CVI float arrays provided you swap bytes since LV stores data on files in big-endian format (most significant byte first) while normally CVI expects data in little-endian format.
Conversion from one format to the other can be performed either in LV or in CVI. Supposing you want to operate on the CVI side you can look at the sample I am attaching, in which a simple VI writes a binary data file and a CVI application reads it back. The CVI project dynamically determines and allocates memory for the file to read.
Message Edited by Roberto Bozzolo on 02-20-2006 06:17 PM
02-20-2006 02:33 PM
02-20-2006 05:48 PM
Hi!
I put your code in main one, and it works. The code you sent me, uses memory allocation, so what if I
have to deal with a data file about several gigabytes? I think then the RAM would be overloaded?
How can I change the LVBinFile.c code you sent me? I just need the LabView file to be converted a file what has a LabWindows
file-format, but every operation without full memory allocation.
(I know this question is an ANSI C question, but i am still quite a biginner even in C 🙂 )
Thank you very much for your help,
best regards,
András Bükki-Deme
02-21-2006 12:01 AM
You can read and process the data file in chunks so that you don't have memory allocation problems. Simply insert the read in a loop until end of file: read a fixed amount of data (say 1000 floats per read) so you don't have to deal with dynamic memory allocation. Take care of the bytes read every time: on the last iteration, immediately before end of file, you may read less than the expected bytes from the file.
02-21-2006 04:07 AM
Thank you! I finished may code, and it works. And I changed it as you said, so it can deal with huge data files now.
And I have no more LabWin - LabView file compatiblity problem, I can convert files between the 2 formats .
Best regards,
András Bükki-Deme