Too many input arguments error
3 次查看(过去 30 天)
显示 更早的评论
i have my function testnetwork
function result = TestNetwork(network, input)
result = input;
b= [-1 -1 -1 -1 ];
% Iterate over all the couches
for i=1:length(network.couches)
result = network.activation(matrix_multiplication_same_dimension(network.couches{i} , vertcat ( result , b)));
end
end
and this is my main
% initialis a cell of zeros for example output = zeros_quat(zeros(1, 2)) is equal to [0 0 0 0] [0 0 0 0]
output = zeros_quat(zeros(10, size(testset,2)));
%
for i = 1:size(testset, 2)
output {:,i} = TestNetwork(network, testset{:,i});
end
end
why i get this error thank for helping me
0 个评论
采纳的回答
James Tursa
2016-6-22
编辑:James Tursa
2016-6-22
It is not clear what "testset" is, but if it is a cell array then the notation you are using in your TestNetwork call will produce a comma-separated-list for testset{:,i}. So if there is more than one row in testset, you will get more than one input argument for the notation testset{:,i}. That, combined with the network argument input, will produce three or more inputs to the TestNetwork function ... hence the error since TestNetwork only takes two inputs. E.g.,
>> testset = {1,2:3;4:6,7:10} % <-- A 2x2 cell array
testset =
[ 1] [1x2 double]
[1x3 double] [1x4 double]
>> testset{:,1} % <-- The first column of testset, "dereferenced" with the curly { } notation
ans =
1
ans =
4 5 6
When you "dereference" the cell array column with the curly brackets { }, the result is a comma-separated-list ... which in this case is equivalent to two values separated by commas. I.e., the notation testset{:,1} is equivalent to the following explicitly types values:
>> testset{1,1},testset{2,1}
ans =
1
ans =
4 5 6
I.e., the curly brackets { } used above is as if you typed in two separate values separated by a comma ... it is equivalent to the above.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Predictive Maintenance Toolbox 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!