TabComplete

버전 1.2.0.0 (6.01 KB) 작성자: Yair Altman
Sets Command-Window tab completion for specified functions & arguments: types and custom strings
다운로드 수: 1.5K
업데이트 날짜: 2012/2/4

라이선스 보기

Argument tab-completion occur when the user presses the <Tab> key following the function name in the Command Window. The list of available/possible arguments is then presented in a popup window.

TABCOMPLETE modifies the [matlabroot '/toolbox/local/TC.xml'] file to set/unset the tab-completion definition of the specified function. Note: changes take effect only after a Matlab restart.

TABCOMPLETE(funcName, argType1, argType2, ...) sets the tab-completion list for function arguments 1, 2, etc. argType can be one of these pre-defined keywords:
- 'var' - list of current workspace variables
- 'fun' - list of accessible functions
- 'subfun' - list of accessible sub-functions
- 'dir' - list of accessible folders (directories)
- 'file' - list of accessible files (of any type)
- 'mfile' - list of accessible *.m files (Matlab functions)
- 'matfile' - list of accessible *.mat files (Matlab data)
- 'figfile' - list of accessible *.fig files (figures)
- 'mdlfile' - list of accessible *.mdl files (Simulink models)
- 'mcospkg' - list of accessible MCOS class packages (R2010a+)
- 'mcosclass' - list of accessible MCOS classes (R2010a+)
- 'messageid' - list of accessible error/warning message IDs (R2011b+)
- (if none of the above is specified, 'subfun' is set automatically)
And in addition to the pre-defined kewords:
- additional string value(s) that will be added to the pop-up list

Multiple types for the same argument can be specified:
- as a cell array - example: {'var','file','on','off'}
- as a space-separated string - example: 'var file on off'

The last argType specified will apply for all subsequent arguments. The last argType may be '' (empty string) to indicate the end of tab-completed args. The last argType does *NOT* accept additional string values like the rest of the arguments.

TABCOMPLETE(funcName,'') removes all arg tab-completions for funcName (this is an immediate corollary of the previous paragraph).

definitions=TABCOMPLETE (without any arguments) returns a structure array listing all the current tab-completion definitions.

definitions=TABCOMPLETE(funcName) returns a structure listing the tab-completion definition for the specified function (if existing).

definitions=TABCOMPLETE(...) returns a structure array listing all tab-completion definitions BEFORE their modification by TABCOMPLETE.

Examples:
tabcomplete('addpath','dir') % sets multiple folder completions
tabcomplete('edit','file fun') % sets multiple file/func completions
tabcomplete('cd','dir','') % sets a single-arg folder completion
tabcomplete('save','matfile',{'var','-struct','-regexp'})
=> *.mat followed by multiple variable-names or '-struct'/'-regexp'
tabcomplete('myFunc','') % removes myFunc's arg tab-completions
defs = tabcomplete('cd') % returns 'cd' function's tab-completions
defs = tabcomplete % returns all currently-defined tab-completions

Warning:
This code heavily relies on undocumented and unsupported Matlab functionality. It works on Matlab 7+, but use at your own risk!

Technical explanation:
A technical explanation of the code in this utility can be found on http://undocumentedmatlab.com/blog/setting-desktop-tab-completions/

Bugs and suggestions:
Please send to Yair Altman (altmany at gmail dot com)

인용 양식

Yair Altman (2024). TabComplete (https://www.mathworks.com/matlabcentral/fileexchange/26830-tabcomplete), MATLAB Central File Exchange. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R2008a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Environment and Settings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.2.0.0

Added MCOSPKG,MCOSCLASS (R2010a+), MESSAGEID (R2011b+) argTypes; warn when using extra vars in R2010a-R2011b; attempt to make TC.xml writeable before updating; fixed possible Matlab hang after answering the backup dialog window

1.1.0.0

Minor fix to msgbox in case of backup problem (per Yogesh's comment)

1.0.0.0