Automatic Refactoring of Classes
显示 更早的评论
I am working in a project that is using multiple classes and I have the need to refactor (rename) some of the classes and functions within those classes. Using an example, I will illustrate the problem that I am facing.
• Let us say that I have two classes in the project. One is called “Class1” and another one is called “Class2”. “Class1” calls ““Class2” and some of its functions.
• I have the need to rename “Class2” to “Class3”. If I do so, that creates a problem in “Class1”. “Class1” will still be referencing “Class2”. Therefore my code does not compile.
• In order to solve this issue I need to go to “Class1” and rename every instance that was referring to “Class2” and substitute it for “Class3”.
• Other languages (or their IDEs) automatically make the change for you. I wanted to know if there was a way to do the same in Matlab.
• If the class is used several times in different classes of the project, refactoring can become a burdensome / extremely difficult task.
Matlab has similar functionality for renaming variables within the same file. Renaming and then pressing “Shift + Enter” does the trick within the same file. Therefore, I am looking for an equivalent solution when you are working with different classes/files in the same project.
采纳的回答
更多回答(1 个)
per isakson
2019-12-18
0 个投票
There are some submission in the File Exchange that should be useful for renaming names over many files. Search for replace in files.
I have successfully used Find and Replace in Files by Robyn Jackey [Staff] to change names in many files.
类别
在 帮助中心 和 File Exchange 中查找有关 Software Development Tools 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!