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 visualizaciones (últimos 30 días)
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 comentarios

Iniciar sesión para comentar.

Respuestas (1)

Jim Riggs
Jim Riggs el 12 de Ag. de 2019
Editada: Jim Riggs el 12 de Ag. de 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.

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by