refactor_fcn_name

버전 1.1.0.0 (2.63 KB) 작성자: Richard Crozier
Change the name of a function called in your m-files and optionally move it too.
다운로드 수: 248
업데이트 날짜: 2013/9/12

라이선스 보기

refactor the name of a function, changing all references to the function name in the path and moving the function file to the new named file

Syntax

refactor_fcn_name(fcnname, newfcnname)
refactor_fcn_name(fcnname, newfcnname, topdir)
refactor_fcn_name(fcnname, newfcnname, topdir, domove)

Description

refactor_fcn_name(fcnname, newfcnname) finds all uses of the function name in fcnname and replaces it with the string in newfcnname in the entire matlab path. The function must be function in an m-file on the Matlab path. By default the mfile containing the fuction is also then renamed to the new name.

refactor_fcn_name(fcnname, newfcnname, topdir) performs the same action but searching the folder provided in 'topdir' and all it's subdirectories rather than the entire Matlab path.

refactor_fcn_name(fcnname, newfcnname, topdir, domove) performs the same action but the 'domove' flag determines whether the function file is actually moved or not. If this evaluates to true the file is moved to the mfile with the new name, if false nothing is moved.

This function requires my other file exchange contributions 'regexprepfile' and 'samesize':

https://www.mathworks.co.uk/matlabcentral/fileexchange/43396-regexprepfile

https://www.mathworks.co.uk/matlabcentral/fileexchange/36636-samesize

Details:

The refactoring is done by performing a regexprep in the files using the simple regex:

\<fcnname\>

인용 양식

Richard Crozier (2024). refactor_fcn_name (https://www.mathworks.com/matlabcentral/fileexchange/43441-refactor_fcn_name), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2012b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Search Path에 대해 자세히 알아보기
태그 태그 추가
도움

받음: samesize, regexprepfile

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.1.0.0

Added missing path2cell subfunction

1.0.0.0