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)

17 Ansichten (letzte 30 Tage)
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 Kommentare

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Jim Riggs
Jim Riggs am 12 Aug. 2019
Bearbeitet: Jim Riggs am 12 Aug. 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.

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by