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

采纳的回答

James Tursa
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.
  1 个评论
AMAL targhi
AMAL targhi 2016-6-22
编辑:Walter Roberson 2016-6-22
i need to load colmun bye column because
result = network.activation( matrix_multiplication_same_dimension( network.couches{i} , vertcat ( result , b)));
network.couche is cell of arrays like multiplication of 2 matrix

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Predictive Maintenance Toolbox 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by