1
我试图找到一个struct字段的类型。CLASS函数必须从类的构造函数调用
席力图召prod
上我认为是一个数组,但我得到这个错误:
??? Error using ==> prod
Dimension argument must be a positive integer scalar within indexing range.
所以我印有问题的对象,并发现这一点:
K>> F.val
ans =
0.110000000000000 0.890000000000000
ans =
0.590000000000000 0.410000000000000 0.220000000000000 0.780000000000000
ans =
0.390000000000000 0.610000000000000 0.060000000000000 0.940000000000000
哪个不同于阵列的输出,这是:
K>> [0.11 0.89 0.59 0.41 0.22 0.78 0.39 0.61 0.06 0.94]
ans =
Columns 1 through 4
0.110000000000000 0.890000000000000 0.590000000000000 0.410000000000000
Columns 5 through 8
0.220000000000000 0.780000000000000 0.390000000000000 0.610000000000000
Columns 9 through 10
0.060000000000000 0.940000000000000
当我调用class
在对象上,我得到这个错误:
K>> class(F.val)
??? Error using ==> class
The CLASS function must be called from a class constructor.
我如何才能找到的F.val
类型?
在您的命令行中,哪个类的输出是什么? – Shai
我猜'F.val'是一个单元阵列。你可以用>> iscell(F.val)'来检查。要将其转换为数组,您可以简单地使用'>> [F.val {:}]' – Shai
如果您愿意,还可以在GUI中深入查看结构 - 双击工作区变量窗口或'openvar( 'F')' – Notlikethat