Search code examples
matlabnntool

MATLAB newlin function


This is simple example for intro to Neural Network toolbox. However, I cannot run it without error. Do you have any suggestions?

Note: I have Neural Network toolbox and I can see inside the newlin function by edit!

>> P1 = {0 -1 1 1 0 -1 1 0 0 1};
>> T1 = {0 -1 0 2 1 -1 0 1 0 1};
>> net = newlin(P1,T1,[0 1],0.01);
??? Undefined function or method 'newlin' for input arguments of type 'cell'.

Solution

  • Check that you have the Neural Network Toolbox installed with:

    ver nnet
    

    EDIT

    I see now, newlin() does NOT accept cell array inputs, i.e. curly braces { }, use square brackets for concatenation, i.e. [ ], to get vectors of type double:

     P1 = [0 -1 1 1 0 -1 1 0 0 1];
     T1 = [0 -1 0 2 1 -1 0 1 0 1];