本文介绍了全局矩阵有何不同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这很好:
spike(waves0);
但这令人惊讶地不是:
toArff(@spike)
error: A(I): Index exceeds matrix dimension.
error: called from:
error: /Users/simpatico/mlr/spike.m at line 4, column 7
error: /Users/simpatico/mlr/toArff.m at line 4, column 16
function toArff = toArff(features)
global waves0;
spike0 = features(waves0);
true = zeros(size(waves0)(1), 1);
P = [spike0 true];
end
推荐答案
您需要先在基本工作区中将waves0
声明为全局变量.
You need to declare waves0
as global in the base workspace first.
或者,您可以使用waves0 = evalin('base', 'waves0');
从基本工作区中获取值.
Alternatively, you can use the waves0 = evalin('base', 'waves0');
to fetch the value from the base workspace.
请注意,所有这些选项均不被认为是好的做法,因为它会引起您所看到的问题,尤其是其中的问题.最好将waves0
作为输入参数传递.
Note that none of these options are considered to be good practice, since it gives rise to exactly the sort of issue you're seeing, amongst others. It would be much better to pass waves0
in as an input parameter.
这篇关于全局矩阵有何不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!