You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: HELP_changeFileExtensions.m
    path of file: ./repos/GIBBON/docs
    
    the code of the file until where you have to start completion: %% changeFileExtensions
% Below is a demonstration of the features of the |changeFileExtensions| function

%%
clear; close all; clc;

%% Syntax
% |changeFileExtensions(pathName,extOld,extNew);|

%% Description
% The |changeFileExtensions| function changes the file extensions for all
% files in 
    
function

%%
clear; close all; clc;

%% Syntax
% |changeFileExtensions(pathName,extOld,extNew);|

%% Description
% The |changeFileExtensions| function changes the file extensions for all
% files in the folder pathName, and with the extension extOld, to have the
% extension extNew.

%% Examples
%

%%
%Create example files in the data/temp directory. Here a set of files with
%the txt extension are created. Later these are changed to have a csv
%file extension.

%Create .txt files
defaultFolder = fileparts(fileparts(mfilename('fullpath')));
pathName=fullfile(defaultFolder,'data','temp','renameCheck');
mkdir(pathName)

n=5;
for q=1:1:n %Create n files
    fileID=fopen(fullfile(pathName,['temp',num2str(q),'.txt']),'w');
    fprintf(fileID,'%d\n',pi);
    fclose(fileID);
end