Too many input arguments error
3 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
James Tursa
on 22 Jun 2016
Edited: James Tursa
on 22 Jun 2016
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 Comment
More Answers (0)
See Also
Categories
Find more on Predictive Maintenance Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!