1

Working on my script in Matlab, I want to rename a variable, but only the upcoming instances of it the current script.

I am familiar with Matlab rename option when pressing Shift+Enter. But this changes all the instances of my 'new' variable in the whole script. I want to change only the proceeding instances.

How could this be done? I also didn't find anything helpful in the Find&Replace window.

3
  • 5
    There is no automated way to do this. It's likely faster to just do it manually than to engineer a solution. Commented Jun 22, 2016 at 13:21
  • 3
    As I know there is no proper refactor functionality in Matlab Editor. Do it manually, or comment out the part which you don't want to rename then press Shift+Enter :) Commented Jun 22, 2016 at 13:23
  • I think I would use this comment/un-comment method. Thank you. Commented Jun 22, 2016 at 13:25

1 Answer 1

1

Copy the remaining portion of your code into a new .m file

Find and replace the variable you want to change.

Copy and paste it back into your original .m file.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.