src/GamIO/ML5SubE.cc
/* These are the functions which will input a sub-element in MATLAB ".mat"
   binary format, version 5.  Note that in a valid MATLAB MAT file, a 
   "Sub-Element" is a combination of Tag + Data
 
                Input           ML5SE	: MAT version 5 sub-element (this)
                                fp      : Input file stream
				bigend  : Stored data endian type
				warn    : Warning output level
                                                0 = no warnings
                                                1 = warnings
                                               >1 = fatal warnings
                Output          void    : ML5SE is set from values found
                                          in the input stream
                Note                    : No care is taken to insure the
                                          sub-element is read at the start
					  of the element (as it should be
 					  in MATLAB)                         */
These are the functions which will input a sub-element in MATLAB ".mat"
binary format, version 5.  Note that in a valid MATLAB MAT file, a
"Sub-Element" is a combination of Tag + Data


These are the functions which will input a sub - element in MATLAB " . mat " binary format version 5 . Note that in a valid MATLAB MAT file a " Sub - Element " is a combination of Tag + Data
int MatLab5SE::read(std::fstream& fp, int bigend, int warn)
  {
  if(!MLTag.read(fp, bigend, (warn)?1:0))	
    {                                           
    if(warn)                                    
      {                                         
      if(warn==1) MLSE5error(10, 1);
      else        MLSE5fatality(10);
      }  
    return 0;
    }
  if(MLData) delete [] MLData;			
  MLData = NULL;				
  int nb = MLTag.NBytes;			
  if(!MLTag.Compressed && nb)			
    { 						
    MLData = new char[nb];			
    for(int i=0; i<nb; i++)			
      fp.read(&(MLData[i]), sizeof(char));
    int left = nb%8;				
    if(left)
      {
      left = 8 - left;	
      char x;
      for(int k=0; k<left; k++)
        fp.read(&x, sizeof(char));
      }
    }
  else 						
    {						
    MLData = new char[4];			
    for(int i=0; i<4; i++)			
      MLData[i] = MLTag.EightBytes[4+i];	
    }
  return 1;
  }
int MatLab5SE :: read ( std :: fstream & fp , int bigend , int warn ) { if ( ! MLTag . read ( fp , bigend , ( warn ) ? 1 : 0 ) ) { if ( warn ) { if ( warn == 1 ) MLSE5error ( 10 , 1 ) ; else MLSE5fatality ( 10 ) ; } return 0 ; } if ( MLData ) delete [ ] MLData ; MLData = NULL ; int nb = MLTag . NBytes ; if ( ! MLTag . Compressed && nb ) { MLData = new char [ nb ] ; for ( int i = 0 ; i < nb ; i ++ ) fp . read ( & ( MLData [ i ] ) , sizeof ( char ) ) ; int left = nb % 8 ; if ( left ) { left = 8 - left ; char x ; for ( int k = 0 ; k < left ; k ++ ) fp . read ( & x , sizeof ( char ) ) ; } } else { MLData = new char [ 4 ] ; for ( int i = 0 ; i < 4 ; i ++ ) MLData [ i ] = MLTag . EightBytes [ 4 + i ] ; } return 1 ; }
These are the functions which will input a sub-element in MATLAB ".mat"
binary format, version 5.
These are the functions which will input a sub - element in MATLAB " . mat " binary format version 5 .
// Read sub-element tag (only) // If this has problems, then // we must deal with them // appropriately now // Delete any current data // Insure it is empty // Get total number of bytes // Read data only if tag is // not compressed & has bytes //   Allocate new data array //   Read in the data array //   End on 8 byte boundary //    if(left) fp.seekp(left, ios::cur);	//   so skip to this point // If it is compressed, only // the last 4 tag bytes are // actually data. Just set // those herein // (& hope MLBytes <= 4 )