MATLAB: Undefined function or variable error using Neural Network Toolbox

Deep Learning ToolboxlstmMATLABneural networkneural network toolboxr2017b

I am following the provided example for Long-Short-Term-Memory networks found in the Neural Network Toolbox (https://de.mathworks.com/help/nnet/examples/classify-sequence-data-using-lstm-networks.html) and whenever I use the code given in the example for training the network
net = trainNetwork(X,Y,layers,options);
I get the following error:
>> net = trainNetwork(X,Y,layers,options);
Training on single GPU.
|=========================================================================================|
| Epoch | Iteration | Time Elapsed | Mini-batch | Mini-batch | Base Learning|
| | | (seconds) | Loss | Accuracy | Rate |
|=========================================================================================|
Error using trainNetwork (line 140)
Undefined function or variable 'endfunction'.
Caused by:
Undefined function or variable 'endfunction'.
I tried re-installing the toolbox and rehasing the toolbox cache but it does not matter. Also, if I try to use
maxEpochs = 150;
miniBatchSize = 27;
shuffle = 'never';
cpu = 'cpu';
options = trainingOptions('sgdm', ...
'MaxEpochs',maxEpochs, ...
'MiniBatchSize',miniBatchSize, ...
'Shuffle', shuffle), 'ExecutionEnvironment' , cpu);
I get this error message:
>> net = trainNetwork(X,Y,layers,options);
Error using trainNetwork (line 140)
Undefined function or variable 'endfunction'.
Caused by:
Undefined function or variable 'endfunction'.
It looks like while using the CPU for computation the function does not even start.
Thanks in advance.

Best Answer

endfunction is for Octave code not MATLAB
Related Question