MATLAB Answers

Translated by

이 페이지의 내용은 영어에서 자동 번역되었습니다. 자동 번역 기능을 해제하려면 "<a class="turn_off_mt" href="#">여기</a>"를 클릭하십시오.

0

Why does [ I N ] & [ O N ] for the neural network doesn't work??

Asked by hana razak on 9 Nov 2017
Latest activity Commented on by hana razak on 12 Nov 2017
Hi,
I'm using MATLAB R2015a. I have the input data, data (1100x90) and target, t (2x90).
I'm not sure how to set the target but I've found the way to set the target by referring from this page;
Am I doing the right approach in setting the target?
Here is how I'm setting the input and target for neural network;
data = horzcat( data{:} ) ; % data 1100x90 double
% target setting
t = zeros (2, 90);
t (1, 1:45) = ones (1,45);
t (2, 46:90) = ones (1, 45); % t 2x90 double
% neural network setting
[ I N ] = [1100 90]
[ O N ] = [2 90]
net = patternnet(10);
[net,tr] = train(net,data,t);
I've only reached here and I got this error.
Too many output arguments.
Error in test_nn (line 24)
[ I N ] = [1100 90]
Please help me to resolve this error.
Thank you
Hana

  0 Comments

Sign in to comment.

1 Answers

Answer by Greg Heath
on 9 Nov 2017
 Accepted Answer

% I don't know why, but that method of multiple variable assignment is only defined for functions
>> x = 0, y = 0
x = 0
y = 0
>> [ x y ] = [ 1 2 ]
Too many output arguments.
>> [ x y ] = [ 1, 2 ]
Too many output arguments.
>> [ x, y ] = [ 1, 2 ]
Too many output arguments.
>> [ x, y ] = [ 1 2 ]
Too many output arguments.
Hope this helps.
Thank you for formally accepting my answer
Greg

  3 Comments

Thanks for your quick reply.
Well, this is my first project using MATLAB. May you explain in details for 'multiple variable assignments is only defined for functions'? And I also don't really get what does this code means.
>> x = 0, y = 0
x = 0
y = 0
>> [ x y ] = [ 1 2 ]
Too many output arguments.
>> [ x y ] = [ 1, 2 ]
Am I on the right track in setting the input and target for the neural network?
What should I do to avoid from getting the same error then?
Thank you
Regards
Hana
EDITED QUESTIONS:
Q1. This is my first project using MATLAB. Will you please explain, in detail, why "multiple variable assignments" are only defined for functions'?
A. I don't know.
Q2. Also, I don't really get what this code means.
A. It just means that your syntax is incorrect.
Q3. What should I do to avoid from getting the same error?
A. Don't use that syntax. I have demonstrated 4 versions and they are all unacceptable.
Use the versions I use in my codes.
Hope this helps.
Greg
Thank you very much for your answers. You really help me a lot.

Sign in to comment.



Translated by