function y = freadbin(in_file,row_size,col_size,type);
%    y = freadbin(in_file,row_size,col_size,type); 
%
%    FREADBIN reads a binary file and store the result in the matrix y.
%    If filename is the only input the format is assumed to be PGM with the 
%    appropriate header information (e.g., row_size, col_size and type is
%    defined in the header). If the desired datafile is binary raw (e.g., no
%    header) the appropriate dimensions and the data type must be specified.
%
%    Input:
%       in_file  : File name of input (e.g., 'image.pgm')
%       row_size : row dimension of in_file
%       col_size : column dimension of in_file
%       type     : matlab string expression
%                  'uchar'    --> unsigned char  (default)
%                  'char'     --> char           (not implemented)
%                  'int'      --> int            
%                  'float'    --> float          
%                  'double'   --> double         
%                  'fcomplex' --> complex float
%                  'dcomplex' --> complex double 
%
%    Output: 
%       y - image 
%
%    Example: 
%       y = freadbin('lenna.512',512,512);
%       image(y);colormap(gray(256));
%
%    See also: fwritebin

%
%File Name: freadbin.m
%Last Modification Date: 9/1/95	08:55:31
%Current Version: freadbin.m	1.4
%File Creation Date: Wed Oct 20 08:30:11 1993
%Author: Jan Erik Odegard  <odegard@dsp>
%
%Copyright: All software, documentation, and related files in this distribution
%           are Copyright (c) 1993 Rice University
%
%Permission is granted for use and non-profit distribution providing that this
%notice be clearly maintained. The right to distribute any portion for profit
%or as part of any commercial product is specifically reserved for the author.
%
%Change History:
%
