フィルターのクリア

How to find those function end with *fun

6 ビュー (過去 30 日間)
Yode
Yode 2017 年 7 月 16 日
コメント済み: Walter Roberson 2017 年 7 月 17 日
As we know,there are structfun,arrayfun,cellfun and so on.Could we find those function with code method in matlab?
As I try,the help *fun doesn't work.
  1 件のコメント
Steven Lord
Steven Lord 2017 年 7 月 17 日
I'm curious. Why do you want to generate such a list?

サインインしてコメントする。

採用された回答

Jan
Jan 2017 年 7 月 17 日
編集済み: Jan 2017 年 7 月 17 日
What about:
FileList = dir(fullfile(matlabroot, '**', '*fun.m'))
But I do not see that this is useful. "Could we find those function with code method": Solve this by opening the docs of e.g. cellfun. Then go to the "See also" line on the bottom and follow the links. You will soon have an overview over all related functions. In opposite to this, knowing that the toolbox path contains "mathfun mech_setup_sfun mfun myfffun myfun mysvmfun myufun ..." is not useful.
  6 件のコメント
Jan
Jan 2017 年 7 月 17 日
While {FileList.name} is elegant, this would be the loop:
for i = 1:numel(FileList)
FileList(i).name
end
Walter Roberson
Walter Roberson 2017 年 7 月 17 日
Note that this solution requires R2017a or later, as that is the version that added support for as a wildcard in dir()

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 7 月 16 日
編集済み: Walter Roberson 2017 年 7 月 16 日
Including package methods and including examples, but excluding built-ins, and excluding methods of object classes that are built into the constructor .m files, the available functions as of R2017a are
Afun aggregatebykeyfun aggregatefun ambgfun arrayfun
basisfun bowlpeakfun bswfun bsxfun
cellfun cgfun chunkfun clientfun code_chart_header_file_sfun code_chart_source_file_sfun code_machine_header_file_sfun code_machine_source_file_sfun confun cwtftboxfun
datamatrixfun datasetfun ddefun dmarrayfun dmbsxfun
elementfun expensive_confun expensive_objfun
filtfun fitfun fitoutputfun fixedchunkfun
gaminlpplotbestfun gaoutfun gaplotbestfun goalfun
hAggregatefun hSlicefun hetfun
idnlfun
kernelfun
mathfun mech_setup_sfun mfun myfffun myfun mysvmfun myufun
objfun outputfun
pCellfunAndArrayfun pagefun pambgfun paralleldemo_gpu_arrayfun paralleldemo_gpu_pagefun parse_ml_fun partitionfun pslinkfun
reducebykeyfun reducefun rowfun rtwdemo_comments_mptfun
shufflefixedchunkfun sldemo_tanksfun slicefun spfun ssGenSfun statrobustwfun stencilfun stepfun structfun symfun
ternaryfun terrainfun
ut0fun
varfun
wavefun wdumfun wfusfun whelpfun wpfun
  4 件のコメント
Yode
Yode 2017 年 7 月 16 日
There is no matlab method to do this or those method will be too complicated??
Walter Roberson
Walter Roberson 2017 年 7 月 16 日
pathdirs = regexp(path, pathsep, 'split');
funs = {};
for diridx = 1 : length(pathdirs)
thisdir = pathdirs{diridx};
file_info = [dir( fullfile(thisdir, '*.m') );
dir( fullfile(thisdir, '*.p') )];
for fileidx = 1 : length(file_info)
thisfile = file_info(fileidx).name;
[~, basefile, ~] = fileparts(thisfile);
if length(basefile) >= 3 && strcmp(basefile(end-2:end), 'fun')
funs{end+1} = basefile;
end
end
end
funs = unique(funs);
fprintf('%s\n', funs{:});

サインインしてコメントする。

カテゴリ

Help Center および File Exchange文件操作 についてさらに検索

Community Treasure Hunt

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

Start Hunting!