Column/multi selection mode

Is there a way in the Matlab editor to select vertical selections of text (like Alt-selection in MS word or Notepad++) and to insert text or an incremented numbered list into a vertical selection? (Notepad++ has this by pressing Alt-C, but can only increment)

1 comentario

James Johns
James Johns el 18 de Oct. de 2017
Dear MathWorks, please implement this functionality. A "Column Mode" in Editor would be fantastic. Also, a "Column Mode" where you can increment numbers would save time as well. In 2017, we still have to open UltraEdit and Excel to do this and paste results in MATLAB.

Iniciar sesión para comentar.

Respuestas (8)

Amy
Amy el 28 de Nov. de 2018
Editada: Amy el 29 de Sept. de 2022

13 votos

Hi all -- column selection mode, or block edit mode, was added to the Live Editor in R2018a, and to the regular MATLAB Editor in R2021b. You can select and edit a rectangular area of code by pressing the Alt key while making a selection with the mouse (or the Option key on macOS). This is mentioned briefly in the release notes for those releases and also in the documentation page for editing and formatting code. Please go ahead and try it out!!

7 comentarios

Joseph Hall
Joseph Hall el 8 de Mzo. de 2019
Any updates on when it will be available in regular editor?
N/A
N/A el 10 de Jul. de 2019
This feature would be very useful - please keep us up to date about the plans when this feature will be available in regular editor.
Bandar
Bandar el 16 de Dic. de 2019
2019, we still have no such feature. Any update?
Nathan Andrews
Nathan Andrews el 16 de Nov. de 2021
2021b has this. Thanks Amy
Nikolaus Koopmann
Nikolaus Koopmann el 26 de En. de 2023
thanks
Alf Magne Meling
Alf Magne Meling el 23 de Mzo. de 2023
Perfect
Joey LeCheminant
Joey LeCheminant el 8 de Jul. de 2024
selecting a rectangular area of code is a great first step, but being able to select different lengths of text in each row would be better! (VS Code is good at this)

Iniciar sesión para comentar.

per isakson
per isakson el 2 de Mzo. de 2012

11 votos

No, but I agree it would be useful!
Every other day I copy blocks of code to Notepad++ to use "vertical selection" and regular expressions.
Bryan Munro
Bryan Munro el 26 de En. de 2018

3 votos

I'll second this, it's hard to overestimate how much time this feature would save me on a daily basis!
Richard Yau
Richard Yau el 8 de Nov. de 2018

3 votos

Mathworks really needs this column edit feature in their editor. There's no reason not to have it and I end up having to temporarily open another editor just to edit something and going back to matlab editor afterwards. Why is this not already available????
Ivan
Ivan el 30 de Oct. de 2020
Editada: Ivan el 30 de Oct. de 2020

3 votos

also was looking for multi line selection, have made this function to open file in notepad++.
Can be used to fast open in any editor, good to assign it to some keyboard shortcut
function edit_in_npp()
% the function will open active in editor file in npp in the corresponding line
% before use check that npp is in your system path or set path to npp_path
% variable below.
% to set path from cmd use setenv('PATH', [getenv('PATH') ';C:\Program Files (x86)\Notepad++']);
npp_path='notepad++.exe'; % or set npp_path=C:\Program Files (x86)\Notepad++\notepad++.exe
doc=matlab.desktop.editor.getActive;
system(sprintf('"%s" "%s" -n%d',npp_path,doc.Filename,doc.Selection(1)));

1 comentario

Peter Scotson
Peter Scotson el 30 de Mzo. de 2021
Very good! Suggest adding an ampersand to the sprintf('... &'). I needed to use the full path to notepad++

Iniciar sesión para comentar.

Maxim Piz
Maxim Piz el 15 de Nov. de 2021

1 voto

I have to use notepad ++ to make easy tasks which the regular editor should be capable of. The is no need to do that in the live editor. This is standard feature for decades.

2 comentarios

Jared MacDonald
Jared MacDonald el 15 de Nov. de 2021
Hi Maxim, column selection mode is available in the regular MATLAB Editor as of R2021b.
Thanks,
Jared
Maxim Piz
Maxim Piz el 15 de Nov. de 2021
Ok, thanks!

Iniciar sesión para comentar.

Walter Roberson
Walter Roberson el 26 de En. de 2018

0 votos

I see no evidence that Mathworks will be making any feature changes to the regular editor, other than in the sense of continuing to work on the code analyzer and autofixes. Otherwise all of the editor development appears to be going into the live editor. Thus I do not expect the column cut or paste to ever be put into the regular editor. I would instead suspect that the live editor is intended to replace the regular editor in time.

7 comentarios

Shuhao Cao
Shuhao Cao el 3 de Mayo de 2020
Two years later, now I concur with you...I am switching to VScode to edit matlab now. Even though I lost cell mode, overall I am pretty happy.
Jared MacDonald
Jared MacDonald el 30 de Oct. de 2020
The features of the Live Editor such as column/block selection (as well as refactoring, duplicate line, and other desirable text editing features) will be available in the regular MATLAB Editor imminently.
Seren
Seren el 19 de Mzo. de 2021
Any update on this Jared?
Jonas Allgeier
Jonas Allgeier el 29 de Jun. de 2021
The R2021b pre-release has this feature in the regular editor.
Snoopy
Snoopy el 12 de Ag. de 2021
In the R2021b pre-release, could you please explain how to select text columnwise on an OSX system? Which key combination should I use?
Walter Roberson
Walter Roberson el 12 de Ag. de 2021
Hold down alt and left click and drag.
(Or... left click and drag letting it be messy and selecting everything not just columns; and then hold down alt and move the mouse (movement is required!!), and it will switch to column selection. But I do not recommend this approach.)
Snoopy
Snoopy el 12 de Ag. de 2021
It works. Thank you.

Iniciar sesión para comentar.

zmi zmi
zmi zmi el 29 de Sept. de 2022

0 votos

On Linux, the Alt shortcut clashes with the Plasma Window Manager shortcut. Change is not feasible on modern notebooks since there is no Meta key on keyboards. Please make it possible to alter the column selection shortcut from Alt to something else.

1 comentario

Amy
Amy el 29 de Sept. de 2022
Hi zmi zmi,
Unfortunately there's no way to change the shortcut for column selection right now, we're still looking into this. In the meantime if you need to disable column selection altogether to avoid conflicts, the command to run is:
>> s=settings;
>> s.matlab.editor.EnableColumnSelection.PersonalValue=0;

Iniciar sesión para comentar.

Categorías

Más información sobre System Commands en Centro de ayuda y File Exchange.

Preguntada:

el 2 de Mzo. de 2012

Comentada:

el 8 de Jul. de 2024

Community Treasure Hunt

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

Start Hunting!

Translated by