Tabbing between opened Editor tabs

30 ビュー (過去 30 日間)
TC Christensen
TC Christensen 2011 年 2 月 26 日
コメント済み: Luc Masset 2020 年 9 月 1 日
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 Center および File ExchangeScripts についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by