MATLAB: (MATLAB TRICK AND SHORTCUTS): I would like to rename all the variables within a script without do it manually one by one

inputrenameshortcutstrickvariablesvector

I have a function with inputs (a,b,c,d) and I would like to have the same function in a vector x such that a=x(1), b=x(2), c=x(3), d=x(4) without rename the one by one.
I am asking that because when I underline a variable such "a" all the "a's" within the code highlight as well. I was thinking that there might be a command to change all of them instantaneously into x(1). The same for the other variable
PS: I possess the version of matlab (R2016a)

Best Answer

One of the option I follow:
  • 1. select the variable you want to replace
  • 2. Press control + f (this is used to find). A pop out comes, there will be a option find, replace,
  • replace all.
  • 3. Type what you want to replace with..
  • 4. Go for find and replace or Replace all.
Be careful while replacing.
Related Question