function solution_write ( node_num, node_u, output_filename ) %% SOLUTION_WRITE writes the solution to a file. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 05 June 2004 % % Author: % % John Burkardt % % Parameters: % % Input, integer NODE_NUM, the number of nodes. % % Input, real NODE_U(NODE_NUM), the coefficients of % the solution. % % Input, character ( len = * ) OUTPUT_FILENAME, the name of the file % in which the data should be stored. % output_unit = fopen ( output_filename, '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', node_u(node) ); end fclose ( output_unit ); return end