Info

此问题已关闭。 请重新打开它进行编辑或回答。

how to ask the User to inform elements to compose a matrix

2 次查看(过去 30 天)
for example:
I ask him the first element, then the second and so on accumulating in the vector.
what I did was
Neuron = [ ] ;
for j=1:(b-1)
     p = input ('enter the number of the neurons', j, 'layer');
     neuron = [neuron p];
end
it happens that when I thus gives error the message is matlab
Too many input arguments.
please someone help me
thank you very much

回答(2 个)

Azzi Abdelmalek
Azzi Abdelmalek 2015-8-2
编辑:Azzi Abdelmalek 2015-8-2
I think it always gives error.
b=4
Neuron = zeros(1,b-1) ;
for jj=1:b-1
p = input ('enter the number of the neurons');
Neuron(jj) = p;
end

Matt J
Matt J 2015-8-2
编辑:Matt J 2015-8-2
Something like this, maybe.
Neuron = nan(1,b-1); ;
for j=1:(b-1)
Neuron(j) = input (['Enter the number of neurons in layer #' num2str(j) ': ']);
end

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by