Too many input arguments error

조회 수: 3 (최근 30일)
AMAL targhi
AMAL targhi 2016년 6월 22일
편집: Walter Roberson 2016년 6월 22일
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