% file_out.m

%% This takes an image I and writes it (row wise) to a file.  The number of 
%% rows and the number of columns are written out first.
%% 'I' needs to be all integers.
%%
%% Written by Justin Romberg, May 1997.
 
function file_out(X, filename)

fid = fopen(filename, 'w');

[n,m] = size(X); 
fwrite(fid, [n m], 'int');
fwrite(fid, X', 'int');

