function write_k_file_updated_nodes(k_file_to_write, k_array, nodal_matrix)
% Writes the keyword file to a new location with updated nodes.
%
%
% INPUTS:   k_file_to_write   - String, name of file to create.
%
%           k_array           - Cell array with the K file contents
%
%           nodal_matrix      - [n x 4] matrix with nodal information
%
% created by: ABR
% date : 2024-04-18

fileID = fopen(k_file_to_write,'w');
for aLoop = 1:size(k_array,2)-1
  fprintf(fileID, '%s\n',k_array{1,aLoop});
end
fprintf(fileID, '%s\n',k_array{1,end});
fprintf(fileID, '*NODE\n')
fprintf(fileID, '%8d%16.6f%16.6f%16.6f\n',nodal_matrix')
fprintf(fileID, '*END')
fclose(fileID);




