function pressure3_write ( file_name, node_num, node_p_variable, ... variable_num, node_c ) %% PRESSURE3_WRITE writes the pressures to a file. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 22 June 2005 % % Author: % % John Burkardt % % Parameters: % % Input, string FILE_NAME, the file name. % % Input, integer NODE_NUM, the number of nodes. % % Input, integer NODE_P_VARIABLE(NODE_NUM), % is the index of the pressure variable associated with the node, % or -1 if there is no associated pressure variable. % % Input, integer VARIABLE_NUM, the number of variables. % % Input, real NODE_C(VARIABLE_NUM), the finite element coefficients. % file_unit = fopen ( file_name, 'wt'); if ( file_unit < 0 ) fprintf ( 1, '\n' ); fprintf ( 1, 'PRESSURE3_WRITE - Warning!\n' ); fprintf ( 1, ' Could not write the file "%s".\n', file_name ); return; end for node = 1 : node_num variable = node_p_variable(node); if ( 0 < variable ) fprintf ( file_unit, ' %14f\n', node_c(variable) ); end end fclose ( file_unit ); return end