function solution_write ( node_num, u, output_file_name ) %% SOLUTION_WRITE writes the solution to a file. % % Modified: % % 24 March 2005 % % Author: % % John Burkardt % % Parameters: % % Input, integer NODE_NUM, the number of nodes. % % Input, real U(NODE_NUM), the coefficients of the solution. % % Input, character OUTPUT_FILE_NAME(*), the name of the file % in which the data should be stored. % output_unit = fopen ( output_file_name, 'wt'); if ( output_unit < 0 ) fprintf ( 1, '\n' ); fprintf ( 1, 'SOLUTION_WRITE - Warning!\n' ); fprintf ( 1, ' Could not write the solution file.\n' ); return; end for node = 1 : node_num fprintf ( output_unit, '%14f\n', u(node) ); end fclose ( output_unit );