multiple line edit is not allowed on MATLAB file editor window?
Show older comments
Hi,
Emacs, Sublime text and Visual studio, etc. They all have multiple line edit.
If you do not know what I mean, please see this video at : https://www.youtube.com/watch?feature=player_embedded&v=qp2WuJ2rEE4
Can we do that?
9 Comments
dpb
on 23 Oct 2015
Well, I don't know it by that description but why don't you tell us what you mean instead of expecting us to go somewhere else?
Dario Mangoni
on 26 Sep 2016
I cannot believe that such a useful feature is not implemented in Matlab editor. It is really a shame! And going on a different text editor it's only a workaround, not a solution.
@dpb: Taekyu Shin explained perfectly what "multiple line edit" stands for: with a video!
And that is by far the best explanation one could give. But anyway: this is a textual description, if clicking on a link had given you some troubles.
Multiple line edit is the feature that allows you to select a slot of text spanning different lines (usually with Alt+click key) so that they can be modified alltogheter. Usually also multiple-cursors-on-different-columns is supported so that the multiple cursors are not forced to lay on the same column.
A nice video should have work better... but this would have forced you to go "somewhere else". Poor...
Joseph Hall
on 8 Mar 2019
I would love for Matlab to support this feature. Please implement it soon.
Steven Lord
on 8 Mar 2019
Marco Pastore
on 21 Mar 2019
It would be a killer feature if implemented in the Matlab Editor, thank you!
Simon Beck
on 5 Mar 2021
It really would be a very useful feature!
please consider it in future releases.
Walter Roberson
on 17 Feb 2022
In new-enough MATLAB releases, the traditional editor has been replaced by the live editor, so rectangular editing is now supported.
Prakash Singh Badal
on 4 Jun 2022
Edited: Prakash Singh Badal
on 4 Jun 2022
In case someone stumbled on this thread, following is the exact answer on how to do it. Note the use of mouse with alt and not keyboard (unlike usual editors).
Answers (4)
Dario Mangoni
on 26 Sep 2016
I would upvote 1billion times this question. Matlab is a so powerful tool that is really becomed lame for its lacking-features Editor.
Together with multiediting, it lacks also of the "duplicate line" feature.
@dpb: Follows a textual description: "Duplicate line" feature allow to duplicate the line you are on, usually pressing Ctrl+D. e.g.
disp('I like textual descriptions')
... pressing Ctrl+D while the cursor is on that line gives
disp('I like textual descriptions')
disp('I like textual descriptions')
Please, don't ask us why this feature is "really useful".
1 Comment
dpb
on 27 Sep 2016
In Brief, numeric keypad '+' copies the current line to buffer and then numeric keypad 'Insert' pastes that buffer (line). Unfortunately for me, the Brief emulation in VS is incomplete and some keystrokes aren't allowed to be remapped at all so it's pretty-much useless.
My question before wasn't anything about whether whatever was/wasn't useful; simply didn't recognize the desired functionality by the description. And, it's certainly much quicker to simply read a simple description than have to go watch a video...and if it takes a video to explain it, I don't care enough and undoubtedly don't use it so don't have anything to add! :)
Stefan de Groot
on 23 Apr 2019
1 vote
Dear Mathworks,
Any update on this feature request please!
Thank you!
Ken Atwell
on 24 Oct 2015
0 votes
The MATLAB Editor does not have this, I think. Do you have an example MATLAB source file you can share with us where this kind of thing would be really useful to have?
4 Comments
Dario Mangoni
on 26 Sep 2016
The fact that vast majority of text editors has this feature should be enough to support the thesis that IS a useful feature.
Sure enough, it's not something that one cannot replace with tons of Ctrl+C Ctrl+V.
The video provides all the details, but anyway:
body1ref_glob = [1;0];
body2ref_glob = [0;1];
body3ref_glob = [1;1];
body4ref_glob = [2;1];
rotLG = [1, 0; 0, -1];
can you please write for me:
body<n>ref_loc = rotLG*body<n>ref_glob;
with multi-edit:
- multi-select body<n>ref_ that spans over 4 rows, copy&paste
- write loc after that (this will be done automatically on all the 4 new rows)
- copy&paste rotLG
- multi-select body<n>ref_glob, copy&paste
- press ; (this will be done automatically on all the 4 new rows)
Philip Pesce
on 7 Apr 2021
Quote: "Do you have an example MATLAB source file you can share with us where this kind of thing would be really useful to have?"
LOL... every MATLAB file I've ever written in over the last 13 years of my career! I end up using Visual Studio Code or Notepad++ to end my MATLAB scripts because the MATLAB editor is awful. And not just because I can't multi-line edit.
Here's another example. Pretend I have the following lines and don't get hung up on having "myElementA" twice.
myBus.mySubBus.myElementA = 2.0;
myBus.mySubBus.myElementB = 3.0;
myBus.mySubBus.myElementA = myBus.mySubBus.myElementB;
If I singe left click myBus, the editor will highlight all four instances of myBus, because it's atthe begining of the line.
But if I single click on mySubBus, the editor is too stupid to recognize that this is used in four places and highlight all of them. Also true for myElementA and myElementB.
Other editors do this and make editing so much easier; MATLAB's editor is like using hammer and chissle.
Jaco-Louis Venter
on 19 May 2021
The most common use I can think of for this feature would be to suppress multiple lines of code with a ;. During development, I leave many lines unsuppressed to make sure the output is what I expect. If I then tidy up my code, I have to spend quite some time inserting ; everywhere. With multi-select this would be a piece of cake.
Damir Rakhimov
on 17 Feb 2022
Edited: Damir Rakhimov
on 17 Feb 2022
I have one - when I need to change the same parameter in multiple scenarios simultaneously on different lines. Please check the attached file. I can use search and replace but the feature of editing multiple lines simultaneously is more handy - I use Sublime for this purpose at the moment. Also I would like to note that the attached example file is the small one, sometimes such files can contain up to fifty or more lines of configurations.
It would be great if such feature will appear in Matlab.
Jared MacDonald
on 25 Aug 2022
0 votes
Please note that the MATLAB Editor has this feature as of R2021b. You can hold "Alt" or "Option" while clicking to make a multi-cursor block selection. Please see the "Edit and Format Code" section of the documentation for more information.
Categories
Find more on Environment and Settings in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!