function fort_write(fname,varOut)
%writes the "fort" file where first two int32 are the dimensions, and the rest is a column major matrix of single precision
% fname - filename
% varOur - data to write

fid         = fopen(fname,'w');
[m,n]      = size(varOut);

fwrite(fid,m,'int32');
fwrite(fid,n,'int32');

for j = 1:n
  fwrite(fid,varOut(:,j),'float32');
end

fid         = fclose(fid);
