Tabbing between opened Editor tabs

33 Ansichten (letzte 30 Tage)
TC Christensen
TC Christensen am 26 Feb. 2011
Kommentiert: Luc Masset am 1 Sep. 2020
Greetings Matlab community,
When using Matlab I usually have several tabs opened in the 'Editor' tab, and often I require to shift between different tabs to look up existing code or compare scripts.
I was wondering if there exists any kind of keyboard shortcut to do so - similarly to cycling through open tabs with 'ctrl+tab' in a browser like Firefox - or if I'm required to actively click my mouse or type in the command window every time?
I look forward to reading your input.
Best regards, Thomas

Akzeptierte Antwort

Jiro Doke
Jiro Doke am 26 Feb. 2011
"Ctrl-Page Up" and "Ctrl-Page Down" will let you switch between different tabs.
  3 Kommentare
Ankan Biswas
Ankan Biswas am 10 Jun. 2015
Look at this link. You can customize the option. "http://blogs.mathworks.com/community/2010/06/07/editor-tab-switching/"
Luc Masset
Luc Masset am 1 Sep. 2020
Seems like this key sequence (<ctrl>+<pagedown> or <ctrl>+<pageup>) also works when you create uitabgroup in your own Matlab GUI. That is crazy. In my GUI there is a lot of keyboard shortcuts. And precisely I designed the key sequences <ctrl>+<pagedown> and <ctrl>+<pageup> to navigate through the results. Each time I was using these two key sequences the selected tab was changing unexpectedly and I struggled for days to understand why.
Would it be possible to TMW not to implement such things in the standard Matlab objects (uitabgroup for instance)? Because it could lead to completely unwanted behaviors and days and days of useless debugging!!! I use Matlab R2017b on Windows FYI.
Regards,
Luc

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Paulo Silva
Paulo Silva am 26 Feb. 2011
I was curious about the question because I always have many open mfiles at the same time in matlab 2008b and the tab navigation is horrible, I didn't knew at the time those shortcuts that Jiro posted so here's a simple GUI that lists the m files currently open in a table and you can select the one you want just by clicking on the name.
function MFileSelector
fig=figure;set(fig,'MenuBar','none');
set(fig,'Name','MFileSelector by Paulo Silva');
set(fig,'NumberTitle','off');
file=com.mathworks.mlservices.MLEditorServices.builtinGetOpenDocumentNames;
out=char(file);
dat=cellstr(out);
rownames=1:size(out,1);
try rownames=cellstr(rownames),catch,end
columnname={['Here''s a list of the matlab open Mfiles'...
',you can select the one you want to edit by clicking on it']};
columnformat = {'char'};
columneditable = [false];
mytable = uitable('Units','normalized','Position',...
[0 0 1 1], 'Data', dat,...
'ColumnName', columnname,...
'ColumnFormat', columnformat,...
'ColumnEditable', columneditable,...
'RowName',rownames);
set(mytable,'ColumnWidth','auto')
%set(mytable,'KeyPressFcn',@selectedfile)
%set(mytable,'ButtonDownFcn',@selectedfile)
set(mytable,'CellSelectionCallback',@selectedfile)
function selectedfile(a,eventdata)
selcell=eventdata.Indices;
edit(out(selcell(1),:));
delete(fig);
end
end

Kategorien

Mehr zu Scripts finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by