Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab 迭代时如何获取方法列表?_Matlab - Fatal编程技术网

Matlab 迭代时如何获取方法列表?

Matlab 迭代时如何获取方法列表?,matlab,Matlab,我想在一个特殊路径中遍历所有类和包。 之后,我想得到方法列表 在命令窗口中,我可以使用以下命令,并且工作正常: a = ?ClassName; a.MethodList(X); 现在我将其分解为一个函数: function s = befehlsreferenz(path) s = what(path); % list MATLAB files in folder for idx = 1:numel(s.classes) c = s.classes(idx); b = ?c

我想在一个特殊路径中遍历所有类和包。 之后,我想得到方法列表

在命令窗口中,我可以使用以下命令,并且工作正常:

a = ?ClassName;
a.MethodList(X);
现在我将其分解为一个函数:

function s =  befehlsreferenz(path)
s = what(path); % list MATLAB files in folder

for idx = 1:numel(s.classes)
    c = s.classes(idx);
    b = ?c;
    b.MethodList(0);        
end
end
我收到一个错误: 请求的输出太多。最可能的原因是左侧缺少[],该列表以逗号分隔 膨胀(第7行)b.MethodList(0)中出现错误

调试时,我可以看到:

c:1x1单元='章节'
b:空的0x0 meta.class

为什么b是空的?如何获取方法列表


1编辑: 下面是一个示例类,也不使用它

classdef TestClass
    %TESTCLASS Summary of this class goes here
    %   Detailed explanation goes here
    
    properties
    end
    
    methods
        function [c] = hallo(a)
            c = 1;
        end
    end
    
end

在Matlab中使用运算符时,通常最好使用底层函数,即
meta.class.fromname(c)

相关文件:


此外,似乎
s.classes(idx)
是一个单元格,使用单元格索引:
s.classes{idx}

请发布
章节的代码。这不是我的代码,所以我不想发布它:(但我在几个类中尝试了它,但它不起作用。你认为我需要在类中添加一些内容吗?请至少发布一个展示此问题的演示类。)