Comments on: Variable and Function Rename https://blogs.mathworks.com/community/2011/09/12/variable-and-function-rename/?s_tid=feedtopost News from the intersection of MATLAB, Community, and the web. Thu, 04 Apr 2013 13:58:51 +0000 hourly 1 https://wordpress.org/?v=6.2.2 By: Jiro Doke https://blogs.mathworks.com/community/2011/09/12/variable-and-function-rename/#comment-45668 Thu, 04 Apr 2013 13:58:51 +0000 https://blogs.mathworks.com/desktop/2011/09/12/variable-and-function-rename/#comment-45668 @Fergal,

In R2011a, you can do something similar to what you’re looking for.

https://www.mathworks.com/help/matlab/release-notes.html#bsq21d3

If you change the file name in the Current Folder Browser, the file open in the Editor will automatically update so that you don’t have to close and reopen the file. Then, you can just change the function declaration line with the new name (use the Auto-Fix feature).

Note: this won’t work if you change the file name from the Command Window

]]>
By: Fergal Mullally https://blogs.mathworks.com/community/2011/09/12/variable-and-function-rename/#comment-45612 Wed, 03 Apr 2013 20:40:03 +0000 https://blogs.mathworks.com/desktop/2011/09/12/variable-and-function-rename/#comment-45612 The tool I’d love to see is a function-and-filename rename. I often start writing a function, call it getFoo() and save it in getFoo.m. Then 10 minutes later I realise a better name would be getFooForBar(). I have to change the name, close the editor, rename the file on the command line, and open the newly named file in the editor again.

It’d be so much nicer if I could click File->Rename… in the menu bar

]]>
By: Jiro Doke https://blogs.mathworks.com/community/2011/09/12/variable-and-function-rename/#comment-33037 Tue, 05 Feb 2013 13:58:39 +0000 https://blogs.mathworks.com/desktop/2011/09/12/variable-and-function-rename/#comment-33037 @Justin,

Yes, it’s still in 12b. It only works when you change the definition of the variable or function, i.e. when it’s on the left hand side of the equal (or a function declaration).

]]>
By: Justin https://blogs.mathworks.com/community/2011/09/12/variable-and-function-rename/#comment-32925 Tue, 05 Feb 2013 03:11:54 +0000 https://blogs.mathworks.com/desktop/2011/09/12/variable-and-function-rename/#comment-32925 Does this still work in 2012b? I just updated and I can’t seem to find “rename” after right clicking on a variable name, nor do I get the “shift+enter” pop up option when renaming. Major disappointment if this fell through the cracks with the new redesign.

]]>
By: Michael Katz https://blogs.mathworks.com/community/2011/09/12/variable-and-function-rename/#comment-8408 Tue, 24 Jan 2012 16:15:56 +0000 https://blogs.mathworks.com/desktop/2011/09/12/variable-and-function-rename/#comment-8408 @Nikolay,
I wish it were easy. Unfortunately if we did introduce a spell checker, we would want to to work well in all the countries where we ship, be sensitive to scientific and mathematical names, and be syntax-aware. It’s a tall order! It’s not out of the question, but if we were do to this, I couldn’t say when it would be released. But the request has not been forgotten.

@KE and @Clovis,
Thanks! We’re happy this has been useful for you.

@Ethan,
Unfortunately not. This version of the tool does not parse into strings.

]]>
By: Ethan Ott https://blogs.mathworks.com/community/2011/09/12/variable-and-function-rename/#comment-8402 Mon, 23 Jan 2012 17:42:24 +0000 https://blogs.mathworks.com/desktop/2011/09/12/variable-and-function-rename/#comment-8402 Will it find and rename references to the variable contained in function arguments taken as strings (as in save(), load(), eval(), etc.)?

]]>
By: Clovis Bonavides https://blogs.mathworks.com/community/2011/09/12/variable-and-function-rename/#comment-8399 Mon, 23 Jan 2012 14:25:47 +0000 https://blogs.mathworks.com/desktop/2011/09/12/variable-and-function-rename/#comment-8399 It also helped me a lot renaming variables in a >6K lines long script I was even afraid to start because of the existing overlaps between var names and comments….

]]>
By: KE https://blogs.mathworks.com/community/2011/09/12/variable-and-function-rename/#comment-8398 Mon, 23 Jan 2012 14:03:31 +0000 https://blogs.mathworks.com/desktop/2011/09/12/variable-and-function-rename/#comment-8398 Like the feature and use it all the time now. Wish it would work for structures (S.temp) as well as variables.

]]>
By: Nikolay https://blogs.mathworks.com/community/2011/09/12/variable-and-function-rename/#comment-8397 Mon, 23 Jan 2012 10:29:38 +0000 https://blogs.mathworks.com/desktop/2011/09/12/variable-and-function-rename/#comment-8397 Nice feature indeed.
I’m waiting for a spell checker to be added to Matlab Editor for ages! It sounds both easy and needy (many programs have this feature, take FireFox), but despite my appeals on the company web page, and to Mathworks sales-people, this feature is still out :(

]]>
By: John https://blogs.mathworks.com/community/2011/09/12/variable-and-function-rename/#comment-8134 Thu, 13 Oct 2011 13:02:50 +0000 https://blogs.mathworks.com/desktop/2011/09/12/variable-and-function-rename/#comment-8134 Now you know what would make Matlab code much much easier to read? To use different brackets for function calls and array indexing…but that’ll never happen ;) I’ll settle for some python-style string manipulation functions though

]]>