function countwriten = writemodelparams(handle,model)
%function countwriten = writemodelparams(handle,model)
% code to write out the modelparameters to a given file handle which
% has been opened for binary writing and
% must not be null and has already been positioned for the correct location
%does not close the file afterwards
%
%Daniel Fraser Oct 2000
%MAX_TRAJECTORYS    = 1000;  must be defined
%MAX_INTERCEPTS     = 10000; must be defined
%Model Parameters

countwriten = 0;
names = fieldnames(model);

for i = 1:size(names,1)
   countwriten = countwriten + fwrite(handle,eval(['model.'names{i}]),'double');
end
