C3DFile.GetAnalog

Previous  Next

 

nStatus = C3DFile.GetAnalog( BYVAL nFile    AS INTEGER,

                             BYREF arrVolt  AS REAL     ) AS INTEGER

 

ref_arr_ad = C3DFile.GetAnalog( BYVAL nFile AS INTEGER ) AS REFERENCE

 


 

Read analog data from file into an MyBASIC2 array.  The function returns the number of frames read if successful.  The second syntax allocates a new array using NEW and fills the array with the analog data.  The return value is a reference to the new array or NULL if failed.

 

Example:

 

' Read all analogs from file

 

DIM volt( nAdFrames, nAnalogs ) AS REAL

 

C3DFile.GetAnalog( nFile, volt )

 

' Here we're using a dynamic array

 

DIM volt AS REFERENCE

 

volt = C3DFile.GetAnalog( hFile )

 

IF ISREF( volt ) THEN

  nAdFrames = C3DFile.GetNoOfAnalogFrames( hFile )

  nAdMult = C3DFile.GetAnalogRate( hFile ) / C3DFile.GetFramerate( hFile )

 

  FOR i = 1 TO nAdFrames

     strName = FORMAT( "Frame %04d    : %10.4f", i, volt(i-1) )

     PRINT strName

 

     FOR j = 2 TO nAnalogs

        strName = FORMAT( "%10.4f", volt(i-1,j-1) )

        PRINT strName

     NEXT j

     PRINT,

  NEXT i

 

  UNREF volt

ENDIF