function write_data_file(filePrefix, similarity,cluster_assignments,points,param_string)
% function write_data_file(filePrefix, similarity,cluster_assignments,points,param_string)
% Writes the similarity, cluster_assignments and points to a data
% file "filePrefix.mat". Also writes the param_string (if not
% empty) to a separate text file "filePrefix.param" to store the
% information/paramters used to generate this file. 
  
  dataFile=strcat(filePrefix,'.mat'); 
  paramFile=strcat(filePrefix,'.param');
  
  % write the parameter file if the param_string is not empty. 
  if (~isempty(param_string))
	fid=fopen(paramFile,'w');
	fprintf(fid, param_string);
	fclose(fid);
  end
  
  similarity____local=similarity; 
  cluster_assignment____local=cluster_assignments;
  points____local =points;
  save(dataFile, 'similarity____local', 'cluster_assignment____local','points____local');
  clear('similarity____local', 'cluster_assignment____local','points____local');
  
  
	
  