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 CenterFile Exchange에서 Scripts에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by