在命令窗口中显示代码,如';帮助';在Matlab中
我正在寻找一种在命令窗口中显示函数代码(未格式化)的方法。通过这种方式,我想轻松地检查预期的输入参数是什么,帮助文本,也许还有代码的某些部分 写作时在命令窗口中显示代码,如';帮助';在Matlab中,matlab,reflection,Matlab,Reflection,我正在寻找一种在命令窗口中显示函数代码(未格式化)的方法。通过这种方式,我想轻松地检查预期的输入参数是什么,帮助文本,也许还有代码的某些部分 写作时 help functionname 我只收到帮助文本 有没有办法获得完整的代码?stantard(非内置)函数的解决方案 你想做什么就做什么 type functionname 例如: >> type mean function y = mean(x,dim,flag,flag2) %MEAN Average or mean
help functionname
我只收到帮助文本
有没有办法获得完整的代码?stantard(非内置)函数的解决方案
你想做什么就做什么
type functionname
例如:
>> type mean
function y = mean(x,dim,flag,flag2)
%MEAN Average or mean value.
% S = MEAN(X) is the mean value of the elements in X if X is a vector.
% For matrices, S is a row vector containing the mean value of each
% column.
···
解决内置函数的问题
内置函数没有Matlab代码;他们是口译员的直接成员。对于这些函数,上述方法不起作用。例如:
>> type find
'find' is a built-in function.
但是,通常仍然有一个函数文件,它只包含注释。你可以用铅笔打开它
open find
这将在Matlab编辑器中打开文件find.m
,其中包含:
%FIND Find indices of nonzero elements.
% I = FIND(X) returns the linear indices corresponding to
% the nonzero entries of the array X. X may be a logical expression.
% Use IND2SUB(SIZE(X),I) to calculate multiple subscripts from
···
键入有效的functionname
。你为什么不把它贴出来作为答案呢?完成了。很高兴它对你有用。注意,这不适用于内置函数