SaveMPS

PURPOSE ^

function OK=SaveMPS(filename, Contain);

SYNOPSIS ^

function OK=SaveMPS(filename, Contain)

DESCRIPTION ^

 function OK=SaveMPS(filename, Contain);

 Save matrix sring Contain in file "filename"
 Return OK == 1 if saving is success
        OK == 0 otherwise

 See also: BuildMPS

 Author: Bruno Luong
 Last update: 18/April/2008

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function OK=SaveMPS(filename, Contain)
0002 % function OK=SaveMPS(filename, Contain);
0003 %
0004 % Save matrix sring Contain in file "filename"
0005 % Return OK == 1 if saving is success
0006 %        OK == 0 otherwise
0007 %
0008 % See also: BuildMPS
0009 %
0010 % Author: Bruno Luong
0011 % Last update: 18/April/2008
0012 
0013 % Default value of something goes wrong
0014 OK=0;
0015 
0016 % Open the file
0017 fid=fopen(filename,'w');
0018 if fid==-1
0019     return
0020 end
0021 
0022 % Write each line
0023 for n=1:size(Contain,1)
0024     fprintf(fid,'%s\n', Contain(n,:));
0025 end
0026 
0027 % Close and exit
0028 fclose(fid);
0029 OK=1;
0030

Generated on Thu 21-Jun-2012 15:39:23 by m2html © 2003