Tabbing between opened Editor tabs

42 次查看(过去 30 天)
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

采纳的回答

Jiro Doke
Jiro Doke 2011-2-26
"Ctrl-Page Up" and "Ctrl-Page Down" will let you switch between different tabs.
  3 个评论
Ankan Biswas
Ankan Biswas 2015-6-10
Look at this link. You can customize the option. "http://blogs.mathworks.com/community/2010/06/07/editor-tab-switching/"
Luc Masset
Luc Masset 2020-9-1
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

请先登录,再进行评论。

更多回答(1 个)

Paulo Silva
Paulo Silva 2011-2-26
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

类别

Help CenterFile Exchange 中查找有关 Scripts 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by