如何调用非内置的内置函数?
How can I call builtin functions that aren't builtin?
table()
has been a standard function in MATLAB since R2013b. As far as I can see from the documentation, there's nothing special about table
, compared to sum
, cell
, struct
, or any other builtin function.
但是,当我尝试使用 builtin('table',var1,...varN)
运行 函数时,我收到一条错误消息:
Error using builtin
Cannot find builtin function 'table'
进一步调查表明它实际上不被视为内置函数:
which('cell')
built-in (C:\Program Files\MATLAB\R2014b\toolbox\matlab\datatypes\cell)
which('table')
C:\Program Files\MATLAB\R2014b\toolbox\matlab\datatypes\@table\table.m % table constructor
|
Not builtin
进一步调查:
which cell2mat
C:\Program Files\MATLAB\R2014b\toolbox\matlab\datatypes\cell2mat.m
which mat2cell
C:\Program Files\MATLAB\R2014b\toolbox\matlab\datatypes\mat2cell.m
which table2array
C:\Program Files\MATLAB\R2014b\toolbox\matlab\datatypes\table2array.m
which struct2cell
built-in (C:\Program Files\MATLAB\R2014b\toolbox\matlab\datatypes\@struct\struct2cell) % struct method
which cell2struct
built-in (C:\Program Files\MATLAB\R2014b\toolbox\matlab\datatypes\@cell\cell2struct) % cell method
因此,cell
是内置的,而 table
不是。 cell2struct
是内置的,而 cell2mat
不是。
为什么会这样,是否有一种简单的方法可以调用 MATLAB 未考虑内置的重载标准函数?
如果你认为为什么部分是"too broad",请无视并跳到问题的最后部分。
builtin
的文档页面给出了明确的定义:
A built-in function is part of the MATLAB executable. MATLAB does not implement these functions in the MATLAB language. Although most built-in functions have a .m file associated with them, this file only supplies documentation for the function.
您可以通过以下方式找到本机函数:
allTables = which ( '-all', 'table' )
allTables(cell2mat(strfind ( allTables, matlabroot )))
它不是完整的,对于某些功能(例如求和),根文件夹中有很多...
table()
has been a standard function in MATLAB since R2013b. As far as I can see from the documentation, there's nothing special about table
, compared to sum
, cell
, struct
, or any other builtin function.
但是,当我尝试使用 builtin('table',var1,...varN)
运行 函数时,我收到一条错误消息:
Error using builtin
Cannot find builtin function 'table'
进一步调查表明它实际上不被视为内置函数:
which('cell')
built-in (C:\Program Files\MATLAB\R2014b\toolbox\matlab\datatypes\cell)
which('table')
C:\Program Files\MATLAB\R2014b\toolbox\matlab\datatypes\@table\table.m % table constructor
|
Not builtin
进一步调查:
which cell2mat
C:\Program Files\MATLAB\R2014b\toolbox\matlab\datatypes\cell2mat.m
which mat2cell
C:\Program Files\MATLAB\R2014b\toolbox\matlab\datatypes\mat2cell.m
which table2array
C:\Program Files\MATLAB\R2014b\toolbox\matlab\datatypes\table2array.m
which struct2cell
built-in (C:\Program Files\MATLAB\R2014b\toolbox\matlab\datatypes\@struct\struct2cell) % struct method
which cell2struct
built-in (C:\Program Files\MATLAB\R2014b\toolbox\matlab\datatypes\@cell\cell2struct) % cell method
因此,cell
是内置的,而 table
不是。 cell2struct
是内置的,而 cell2mat
不是。
为什么会这样,是否有一种简单的方法可以调用 MATLAB 未考虑内置的重载标准函数?
如果你认为为什么部分是"too broad",请无视并跳到问题的最后部分。
builtin
的文档页面给出了明确的定义:
A built-in function is part of the MATLAB executable. MATLAB does not implement these functions in the MATLAB language. Although most built-in functions have a .m file associated with them, this file only supplies documentation for the function.
您可以通过以下方式找到本机函数:
allTables = which ( '-all', 'table' )
allTables(cell2mat(strfind ( allTables, matlabroot )))
它不是完整的,对于某些功能(例如求和),根文件夹中有很多...