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)

조회 수: 21 (최근 30일)
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

댓글을 달려면 로그인하십시오.

답변 (1개)

Jim Riggs
Jim Riggs 2019년 8월 12일
편집: Jim Riggs 2019년 8월 12일
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.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by