Is it possible to only rename instances of a variable that appear in the code after the point at which you edit the variable selected? (shift+enter)

26 visualizzazioni (ultimi 30 giorni)
I want to change the names of all variables that share a common name, but only after a certain point.
v1 = 2
x = v1 + 3
y = v1 + 2
z = v1 + 4
in the code above, if I replace the name of v1 in line 2 with v2, and press shift + enter, it replaces every v1 to v2.
Is there a way for it to leave all lines of code above the current line unchanged?
Thanks
  6 Commenti

Accedi per commentare.

Risposte (1)

Jim Riggs
Jim Riggs il 12 Ago 2019
Modificato: Jim Riggs il 12 Ago 2019
I use a tool called UltraEdit. It has that capability. In the find/replace tab there is a checkbox for "replace all is from top of file".
Simply uncheck this box and "replace all" operates from the cursor to the end of file.
UltraEdit can also restrict edits to a selected column or range of columns of data. Great feature.

Community Treasure Hunt

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

Start Hunting!

Translated by