MATLAB: How to change the name of a file inputted to a function in MATLAB

renametext file

I want to input a text file to a function, and after running the function, want to change the filename to a specific thing, depending on the results of the function. For example, if the function classifies the folder as belonging to History, I want to rename the text document to History1, if another test file gets classified as belonging to topic history, I want it to be renamed as History2, and so on, and placed in a specific folder.