Why does tab complete not work for user written functions that except filenames?

1 次查看(过去 30 天)
Why does tab complete not work for user written functions that except filenames?
function testFunction(file)
disp(file)
end %end function
Call the above function with a file. While entering the file name, try to tab complete it. It won't work. Why not?

采纳的回答

Walter Roberson
Walter Roberson 2013-8-14
编辑:Walter Roberson 2013-8-14
The rules for tab completion are not well defined, and do not always make sense.
Tab completion for a quoted string takes place if:
  • the quoted string is the first expression (possibly after whitespace) after the beginning of the line, or after a comma (",") or semi-colon (";") that marks the end of anything previous on the line
  • the quoted string immediately follows (no whitespace) a non-quoted underscore ('_') or period ('.')
  • the quoted string immediately follows (no whitespace) a latin letter or latin digit
In addition, there are circumstances under which a quoted string that follows an exclamation mark ('!') may lead to a flawed tab completion, in which the resulting word is missing one or more characters from the file name.
None of the above situations match attempting to enter a valid quoted string as the argument to a function. :(

更多回答(1 个)

David Sanchez
David Sanchez 2013-8-14
The user defined function has to be saved on the current directory or its path set on matlab paths. Matlab will not autocomplete a function name of a function located in a directory different to the working directory.
  1 个评论
Jason Nicholson
Jason Nicholson 2013-8-14
I appreciate your answer but it is not correct. The function is definitely on my path and so is the file. I have folder called UserDefinedFunctions where I store my often used scripts. You can see it the 3rd line of my path shown below. The files are most often in my current working folder.
>> path
MATLABPATH
C:\Users\jnicholson\Documents\MATLAB\UserDefinedFunctions\measuretool_1.13 C:\Users\jnicholson\Documents\MATLAB\CoDaTo C:\Users\jnicholson\Documents\MATLAB\UserDefinedFunctions C:\MathWorks\MATLAB\R2010b\toolbox\matlab\general C:\MathWorks\MATLAB\R2010b\toolbox\matlab\ops C:\MathWorks\MATLAB\R2010b\toolbox\matlab\lang C:\MathWorks\MATLAB\R2010b\toolbox\matlab\elmat C:\MathWorks\MATLAB\R2010b\toolbox\matlab\randfun C:\MathWorks\MATLAB\R2010b\toolbox\matlab\elfun C:\MathWorks\MATLAB\R2010b\toolbox\matlab\specfun C:\MathWorks\MATLAB\R2010b\toolbox\matlab\matfun C:\MathWorks\MATLAB\R2010b\toolbox\matlab\datafun C:\MathWorks\MATLAB\R2010b\toolbox\matlab\polyfun C:\MathWorks\MATLAB\R2010b\toolbox\matlab\funfun C:\MathWorks\MATLAB\R2010b\toolbox\matlab\sparfun C:\MathWorks\MATLAB\R2010b\toolbox\matlab\scribe C:\MathWorks\MATLAB\R2010b\toolbox\matlab\graph2d C:\MathWorks\MATLAB\R2010b\toolbox\matlab\graph3d C:\MathWorks\MATLAB\R2010b\toolbox\matlab\specgraph C:\MathWorks\MATLAB\R2010b\toolbox\matlab\graphics C:\MathWorks\MATLAB\R2010b\toolbox\matlab\uitools C:\MathWorks\MATLAB\R2010b\toolbox\matlab\strfun C:\MathWorks\MATLAB\R2010b\toolbox\matlab\imagesci C:\MathWorks\MATLAB\R2010b\toolbox\matlab\iofun C:\MathWorks\MATLAB\R2010b\toolbox\matlab\audiovideo C:\MathWorks\MATLAB\R2010b\toolbox\matlab\timefun C:\MathWorks\MATLAB\R2010b\toolbox\matlab\datatypes C:\MathWorks\MATLAB\R2010b\toolbox\matlab\verctrl C:\MathWorks\MATLAB\R2010b\toolbox\matlab\codetools C:\MathWorks\MATLAB\R2010b\toolbox\matlab\helptools C:\MathWorks\MATLAB\R2010b\toolbox\matlab\winfun C:\MathWorks\MATLAB\R2010b\toolbox\matlab\winfun\net C:\MathWorks\MATLAB\R2010b\toolbox\matlab\demos C:\MathWorks\MATLAB\R2010b\toolbox\matlab\timeseries C:\MathWorks\MATLAB\R2010b\toolbox\matlab\hds C:\MathWorks\MATLAB\R2010b\toolbox\matlab\guide C:\MathWorks\MATLAB\R2010b\toolbox\matlab\plottools C:\MathWorks\MATLAB\R2010b\toolbox\local C:\MathWorks\MATLAB\R2010b\toolbox\matlab\datamanager C:\MathWorks\MATLAB\R2010b\toolbox\shared\simulink C:\MathWorks\MATLAB\R2010b\toolbox\shared\instrument C:\MathWorks\MATLAB\R2010b\toolbox\simulink\simulink C:\MathWorks\MATLAB\R2010b\toolbox\simulink\simulink\slresolve C:\MathWorks\MATLAB\R2010b\toolbox\simulink\blocks C:\MathWorks\MATLAB\R2010b\toolbox\simulink\components C:\MathWorks\MATLAB\R2010b\toolbox\simulink\fixedandfloat C:\MathWorks\MATLAB\R2010b\toolbox\simulink\fixedandfloat\fxpdemos C:\MathWorks\MATLAB\R2010b\toolbox\simulink\fixedandfloat\obsolete C:\MathWorks\MATLAB\R2010b\toolbox\simulink\simdemos C:\MathWorks\MATLAB\R2010b\toolbox\simulink\simdemos\aerospace C:\MathWorks\MATLAB\R2010b\toolbox\simulink\simdemos\automotive C:\MathWorks\MATLAB\R2010b\toolbox\simulink\simdemos\industrial C:\MathWorks\MATLAB\R2010b\toolbox\simulink\simdemos\simfeatures C:\MathWorks\MATLAB\R2010b\toolbox\simulink\simdemos\simgeneral C:\MathWorks\MATLAB\R2010b\toolbox\simulink\dee C:\MathWorks\MATLAB\R2010b\toolbox\shared\glue C:\MathWorks\MATLAB\R2010b\toolbox\shared\glue\studio C:\MathWorks\MATLAB\R2010b\toolbox\shared\dastudio\depviewer C:\MathWorks\MATLAB\R2010b\toolbox\stateflow\stateflow C:\MathWorks\MATLAB\R2010b\toolbox\rtw\rtw C:\MathWorks\MATLAB\R2010b\toolbox\shared\sigbldr C:\MathWorks\MATLAB\R2010b\toolbox\simulink\simulink\mplayio C:\MathWorks\MATLAB\R2010b\toolbox\simulink\simulink\dataobjectwizard C:\MathWorks\MATLAB\R2010b\toolbox\shared\hdlshared C:\MathWorks\MATLAB\R2010b\toolbox\rtw\accel C:\MathWorks\MATLAB\R2010b\toolbox\rtw\targets\shared C:\MathWorks\MATLAB\R2010b\toolbox\simulink\simulink\modeladvisor C:\MathWorks\MATLAB\R2010b\toolbox\simulink\simulink\modeladvisor\fixpt C:\MathWorks\MATLAB\R2010b\toolbox\stateflow\sfdemos C:\MathWorks\MATLAB\R2010b\toolbox\stateflow\coder C:\MathWorks\MATLAB\R2010b\toolbox\rtw\rtwdemos C:\MathWorks\MATLAB\R2010b\toolbox\rtw\rtwdemos\rsimdemos C:\MathWorks\MATLAB\R2010b\toolbox\rtw\targets\asap2\asap2 C:\MathWorks\MATLAB\R2010b\toolbox\rtw\targets\asap2\asap2\user C:\MathWorks\MATLAB\R2010b\toolbox\rtw\targets\common\can\blocks C:\MathWorks\MATLAB\R2010b\toolbox\rtw\targets\common\tgtcommon C:\MathWorks\MATLAB\R2010b\toolbox\rtw\targets\connectivity C:\MathWorks\MATLAB\R2010b\toolbox\rtw\targets\pil C:\MathWorks\MATLAB\R2010b\toolbox\rtw\rtw\datadiff\gui C:\MathWorks\MATLAB\R2010b\toolbox\rtw\rtw\datadiff\gui\icons C:\MathWorks\MATLAB\R2010b\toolbox\rtw\rtw\datadiff\api C:\MathWorks\MATLAB\R2010b\toolbox\rtw\rtw\cgv\api C:\MathWorks\MATLAB\R2010b\toolbox\rtw\rtw\misra C:\MathWorks\MATLAB\R2010b\toolbox\shared\asynciolib C:\MathWorks\MATLAB\R2010b\toolbox\rtw\targets\autosar\autosar C:\MathWorks\MATLAB\R2010b\toolbox\shared\cgir_fe C:\MathWorks\MATLAB\R2010b\toolbox\shared\comparisons C:\MathWorks\MATLAB\R2010b\toolbox\compiler C:\MathWorks\MATLAB\R2010b\toolbox\compiler\compilerdemos C:\MathWorks\MATLAB\R2010b\toolbox\control\control C:\MathWorks\MATLAB\R2010b\toolbox\control\ctrlguis C:\MathWorks\MATLAB\R2010b\toolbox\control\ctrlobsolete C:\MathWorks\MATLAB\R2010b\toolbox\control\ctrlutil C:\MathWorks\MATLAB\R2010b\toolbox\control\ctrldemos C:\MathWorks\MATLAB\R2010b\toolbox\shared\slcontrollib C:\MathWorks\MATLAB\R2010b\toolbox\shared\dastudio C:\MathWorks\MATLAB\R2010b\toolbox\shared\controllib\engine C:\MathWorks\MATLAB\R2010b\toolbox\shared\controllib\engine\options C:\MathWorks\MATLAB\R2010b\toolbox\shared\controllib\engine\optim C:\MathWorks\MATLAB\R2010b\toolbox\shared\controllib\general C:\MathWorks\MATLAB\R2010b\toolbox\shared\controllib\graphics C:\MathWorks\MATLAB\R2010b\toolbox\shared\controllib\requirements C:\MathWorks\MATLAB\R2010b\toolbox\dspblks\dspblks C:\MathWorks\MATLAB\R2010b\toolbox\dspblks\dspmasks C:\MathWorks\MATLAB\R2010b\toolbox\dspblks\dspmex C:\MathWorks\MATLAB\R2010b\toolbox\dspblks\dspdemos C:\MathWorks\MATLAB\R2010b\toolbox\shared\filterdesignlib C:\MathWorks\MATLAB\R2010b\toolbox\dspblks\splibmex C:\MathWorks\MATLAB\R2010b\toolbox\shared\system C:\MathWorks\MATLAB\R2010b\toolbox\shared\dspblks\dspblks C:\MathWorks\MATLAB\R2010b\toolbox\shared\dspblks\dspmex C:\MathWorks\MATLAB\R2010b\toolbox\fixedpoint\fixedpoint C:\MathWorks\MATLAB\R2010b\help\toolbox\dspblks\examples C:\MathWorks\MATLAB\R2010b\toolbox\eml\eml C:\MathWorks\MATLAB\R2010b\toolbox\emlcoder\emlcoder C:\MathWorks\MATLAB\R2010b\toolbox\emlcoder\emlcodermex C:\MathWorks\MATLAB\R2010b\toolbox\shared\simtargets C:\MathWorks\MATLAB\R2010b\toolbox\emlcoder\emlcoderdemos C:\MathWorks\MATLAB\R2010b\toolbox\exlink C:\MathWorks\MATLAB\R2010b\toolbox\fixedpoint\fidemos C:\MathWorks\MATLAB\R2010b\toolbox\fixedpoint\fixedpointtool C:\MathWorks\MATLAB\R2010b\toolbox\shared\spcuilib C:\MathWorks\MATLAB\R2010b\toolbox\shared\siglib C:\MathWorks\MATLAB\R2010b\toolbox\fuzzy\fuzzy C:\MathWorks\MATLAB\R2010b\toolbox\fuzzy\fuzdemos C:\MathWorks\MATLAB\R2010b\toolbox\fuzzy\fuzzyutil C:\MathWorks\MATLAB\R2010b\toolbox\ident\ident C:\MathWorks\MATLAB\R2010b\toolbox\ident\nlident C:\MathWorks\MATLAB\R2010b\toolbox\ident\idobsolete C:\MathWorks\MATLAB\R2010b\toolbox\ident\idguis C:\MathWorks\MATLAB\R2010b\toolbox\ident\idutils C:\MathWorks\MATLAB\R2010b\toolbox\ident\iddemos C:\MathWorks\MATLAB\R2010b\toolbox\ident\iddemos\examples C:\MathWorks\MATLAB\R2010b\toolbox\ident\idhelp C:\MathWorks\MATLAB\R2010b\toolbox\slvnv\simcoverage C:\MathWorks\MATLAB\R2010b\toolbox\optim\optim C:\MathWorks\MATLAB\R2010b\toolbox\optim\optimdemos C:\MathWorks\MATLAB\R2010b\toolbox\shared\optimlib C:\MathWorks\MATLAB\R2010b\toolbox\slvnv\reqmgt C:\MathWorks\MATLAB\R2010b\toolbox\slvnv\slvnv C:\MathWorks\MATLAB\R2010b\toolbox\slvnv\rmidemos C:\MathWorks\MATLAB\R2010b\toolbox\shared\rptgen C:\MathWorks\MATLAB\R2010b\toolbox\sam\studio C:\MathWorks\MATLAB\R2010b\toolbox\sam\sl2sam C:\MathWorks\MATLAB\R2010b\toolbox\sam\m3i C:\MathWorks\MATLAB\R2010b\toolbox\sam\targets\autosar C:\MathWorks\MATLAB\R2010b\toolbox\sam\studio\hgdialogs C:\MathWorks\MATLAB\R2010b\toolbox\simulink\blocks\sb2sl C:\MathWorks\MATLAB\R2010b\toolbox\shared\eml\eml C:\MathWorks\MATLAB\R2010b\toolbox\signal\signal C:\MathWorks\MATLAB\R2010b\toolbox\signal\sigtools C:\MathWorks\MATLAB\R2010b\toolbox\signal\sptoolgui C:\MathWorks\MATLAB\R2010b\toolbox\signal\sigdemos C:\MathWorks\MATLAB\R2010b\toolbox\sl3d\sl3d C:\MathWorks\MATLAB\R2010b\toolbox\sl3d\sl3ddemos C:\MathWorks\MATLAB\R2010b\toolbox\slcontrol\slcontrol C:\MathWorks\MATLAB\R2010b\toolbox\slcontrol\slctrlguis C:\MathWorks\MATLAB\R2010b\toolbox\slcontrol\slctrlutil C:\MathWorks\MATLAB\R2010b\toolbox\slcontrol\slctrldemos C:\MathWorks\MATLAB\R2010b\toolbox\slcontrol\slctrlobsolete C:\MathWorks\MATLAB\R2010b\toolbox\sldo\sldo C:\MathWorks\MATLAB\R2010b\toolbox\sldo\sldodemos C:\MathWorks\MATLAB\R2010b\toolbox\sldo\sldodemos\optim C:\MathWorks\MATLAB\R2010b\toolbox\sldo\sldodemos\estim C:\MathWorks\MATLAB\R2010b\toolbox\sldo\sldodemos\estim\docexamples\adaptive C:\MathWorks\MATLAB\R2010b\toolbox\sldo\sldodemos\estim\docexamples\lookuptable C:\MathWorks\MATLAB\R2010b\toolbox\sldo\sloptim\sloptim C:\MathWorks\MATLAB\R2010b\toolbox\sldo\sloptim\sloptguis C:\MathWorks\MATLAB\R2010b\toolbox\sldo\sloptim\sloptobsolete C:\MathWorks\MATLAB\R2010b\toolbox\sldo\slestim\slestguis C:\MathWorks\MATLAB\R2010b\toolbox\sldo\slestim\slestim C:\MathWorks\MATLAB\R2010b\toolbox\sldo\slestim\slestmex C:\MathWorks\MATLAB\R2010b\toolbox\sldo\slestim\slestutil C:\MathWorks\MATLAB\R2010b\toolbox\shared\sldv C:\MathWorks\MATLAB\R2010b\toolbox\shared\slvnv C:\MathWorks\MATLAB\R2010b\toolbox\symbolic\symbolic C:\MathWorks\MATLAB\R2010b\toolbox\symbolic\symbolicdemos C:\MathWorks\MATLAB\R2010b\toolbox\shared\testmeaslib\general C:\MathWorks\MATLAB\R2010b\toolbox\shared\testmeaslib\graphics

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by