You can use savepath folderName/pathdef.m saves the current search path to pathdef.m located in the folder specified by folderName. If you do not specify folderName, then savepath saves pathdef.m in the current folder.
Follow the below link for information: