DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Load multiple binary files (.r32/.r64) with DataLoadSel or similar function(s)

Solved!
Go to solution

I want to automatically load many R32-files into the data base, there is no DAT-file containing the structure, it must be created. Currently my script gets a file list an then a loop generates a header for each file and reads it. The structures are beeing set correctly, the first file is read out correctly, but after that the channel data of each following file is empty/filled with nearby zeros.

 

If I read out each single file, the data is correct. There is a new function DataFileLoadSel but it can't read binary data files.

 

I think the indexing is proper. I have no idea why rereading doesn't work, any suggestions?

 

Code:

do while (numLoop > 0)

Call HDDelAll()

GHDChnNo = DynChannelNo

GHDChnLength = ChannelLength

GHDChnType = "EXPLICIT"

GHDDispFormat= "Numeric"

GHDChnFile = chnFile

GHDSaveType = "BLOCK"

GHDChnIdx = 1

GHDChnMode = "REAL32"

Call HDCreate()

Call GroupNameChk("EMB-BKV-Data-"&(numFile+1)) '... GroupCreateName

Call GroupCreate("EMB-BKV-Data-"&(numFile+1),numFile+1,0) '...

Call GroupDefaultSet(numFile+1) '... TargetGroupIndex

Call DataLoadSel(chnFile,"1-",0) '... DataFile,ChnNoStr,IncludeHdLoad

...

loop

 ...

 

0 Kudos
Message 1 of 2
(3,249 Views)
Solution
Accepted by topic author olhass

I found the mistake: ChannelLength is not equal for each file, it has to be calculated first.

'get file length

retVal = filesize(chnFile)

ChannelLength = round(retVal / (sizeOfFloat * DynChannelNo))

if (ChannelLength * sizeOfFloat * DynChannelNo) <> retVal then 'error handling

0 Kudos
Message 2 of 2
(3,233 Views)