I tried the code again with Matlab 2008a and it works fine for me. Your error simply means that in the function 'trainpso.m' the variable 'net' can not be found or read. This will happen if a call to 'clear net' or 'clear all' was made.
I advise you to train using the original code again and becareful when making modifications.
You get this error because you need to download the PSO toolbox and set the path in MATLAB. This is explained in the README file in this add-in, however for your convenience here is what you need to do to fix this error:
1. Download the PSO toolbox at http://www.mathworks.com/matlabcentral/fileexchange/28291-particle-swarm-optimization-research-toolbox.
2. Unzip the downloaded file.
3. On the MATLAB interface go to file -> set path -> add with subfolders. Then find the location of the unzipped downloaded file. -> Save
By following these steps MATLAB should recognise the Control_panel function.
I'd like to test out your addin but i get the following error in Matlab 2012a
??? Error using ==> trainpso at 54
Error in ==> network.subsasgn>setTrainFcn at 2016
net.trainParam = feval(trainFcn,'defaultParam');
Error in ==> network.subsasgn>network_subsasgn at 462
if isempty(err), [net,err]=setTrainFcn(net,trainFcn); end
Error in ==> network.subsasgn at 11
net = network_subsasgn(net,subscripts,v,netname);
Error in ==> NN_training_demo at 20
net.trainFcn = 'trainpso'; %set the NN training function to use a PSO approach.
The name 'trainpso' is used for consistency with previous research (B. Birge,
How to fix this error?
am using NN_training_demo nad getting the same problem with psotrain it seems unidentifed by NN toolbox. i run it on matlab 2012a. my PSO toolbox was obtained from the same link provided above by Tricia. please help
Dear Tricia Rambharose
i am also using same toolbox and your add in but i facing some many errors.
when i compile trainpso file that gives
Error using trainpso (line 25)
Not enough input arguments.
function [net, tr] = trainpso(net, tr, trainV, valV, testV, varargin)
and when i use this tool box to train the network for my own model even working on trainlm but doesn't work on trainpso and gives following error.
SWITCH expression must be a scalar or string constant.
Error in network/subsref (line 140)
Error in trainpso (line 65)
max_perf_inc = net.trainParam.max_perf_inc;
Error in LoadScriptNN (line 84)
net = trainpso(net, trainX', trainY');
pleas reply me asap.
i am very very very grateful to you for this.
i am waiting for reply
I think I found a crucial bug: in my program I write down the test parameters if they fit better than in the iterations before. In my test PSO stopped after fulfilling a break condition and gave me a final parameter set, which fitted less than an intermediate result I wrote down before.