function [X] = loadraw(rawfile, Width, Height) % LOADRAW Load Raw image files. % % [X]=LOADRAW(rawfile, Width, Height) loads a raw image file % specified by "rawfile", returning the image data in variable % "X". The .RAW extension in the filename is optional. % Usage: % A = loadraw('one8x10' ,8, 10); % imagesc(x) % colormap(gray(256)) % 1999-07-21:DAV: David Cary: added "usage" documentation. % Andrew Segall % January, 1996 if nargin~=3 error('LOADRAW takes three arguments.'); end if isempty(findstr(rawfile,'.')), rawfile=[rawfile,'.raw']; end fid=fopen(rawfile,'rb','ieee-le'); if fid==-1 error('Can''t open .RAW file for input!'); end X=fread(fid,[Width, Height],'uint8'); X=X'; fclose(fid); %x = zeros(height,width); %fp = fopen(fid,'r'); %x(:) = fread(fp,height*width,'uint8'); %fclose(fp);