src/GamIO/ML4Tag.cc
/* These are the functions which will input a tag in MATLAB ".mat" binary
   format, version 4.  Note that in a valid MATLAB MAT file, this tag will
   associated with a "Data Element", a combination of Tag + Data 

		Input           ML4T    : MAT version 4 tag (this)
           			fp	: Input file stream
                                warn	: Warning output level
                                                0 = no warnings
                                                1 = warnings
                                               >1 = fatal warnings
		Output		void    : ML4T is set from values found
					  in the input stream
		Note			: No care is taken to insure the
					  tag is read from the top of a data
					  element (as it should be in MATLAB)*/
These are the functions which will input a tag in MATLAB ".mat" binary
format, version 4.  Note that in a valid MATLAB MAT file, this tag will
associated with a "Data Element", a combination of Tag + Data


These are the functions which will input a tag in MATLAB " . mat " binary format version 4 . Note that in a valid MATLAB MAT file this tag will associated with a " Data Element " a combination of Tag + Data
int MatLab4Tag::read(std::fstream& fp, int warn)
  {
  fp.read((char*)&type,   sizeof(int32_t));	
  fp.read((char*)&mrows,  sizeof(int32_t));	
  fp.read((char*)&ncols,  sizeof(int32_t));	
  fp.read((char*)&cmplxf, sizeof(int32_t));	
  fp.read((char*)&nlen,   sizeof(int32_t));	
  if(!fp)
    {
    MLT4error(1, 1);				
    if(warn > 1) MLT4fatality(3);		
    else         MLT4error(3,1);
    return 0;
    }
  Type2MOPT();					
  if((!MLM && WeRBigEnd()) ||( MLM && !WeRBigEnd()))
    {						
    Swap(mrows);				
    Swap(ncols);				
    Swap(cmplxf);
    Swap(nlen);
    }
  return 1;
  }
int MatLab4Tag :: read ( std :: fstream & fp , int warn ) { fp . read ( ( char * ) & type , sizeof ( int32_t ) ) ; fp . read ( ( char * ) & mrows , sizeof ( int32_t ) ) ; fp . read ( ( char * ) & ncols , sizeof ( int32_t ) ) ; fp . read ( ( char * ) & cmplxf , sizeof ( int32_t ) ) ; fp . read ( ( char * ) & nlen , sizeof ( int32_t ) ) ; if ( ! fp ) { MLT4error ( 1 , 1 ) ; if ( warn > 1 ) MLT4fatality ( 3 ) ; else MLT4error ( 3 , 1 ) ; return 0 ; } Type2MOPT ( ) ; if ( ( ! MLM && WeRBigEnd ( ) ) || ( MLM && ! WeRBigEnd ( ) ) ) { Swap ( mrows ) ; Swap ( ncols ) ; Swap ( cmplxf ) ; Swap ( nlen ) ; } return 1 ; }
These are the functions which will input a tag in MATLAB ".mat" binary
format, version 4.
These are the functions which will input a tag in MATLAB " . mat " binary format version 4 .
// Read in computer type // Read in array rows // Read in array columns // Read in real/complex flag // Read in name length // Problems with filestream // Can't read header // Set MOPT from type // If read data is little // endian yet we are big // endian (or vice-versa) // we must do byte swapping