MATLAB: How can use (if, end) inside the neural network script

Deep Learning Toolboxend) inside the neural network script?how can use (if

I have a script for neural network for 4 inputs and 1 target data (each one 104 times observation). when I run the network, the variety of performance in different runs are to much and it is sometime more and leas than 3, where my ideal performance is leas than 3. In order to solve this problem, I want to use a (if, then) inside the script. Although, I do not know this is applicable or not, but the network would not goes inside the loop. I would really appreciate to tell me how can I use (if, end) statement inside the script.
inputs = x;
targets = t;
[ I, N ]= size(x);
performance=10;
if performance>3
% Create a Fitting Network
H = 10;
TF={'tansig','purelin'};
net = newff(x,t,H,TF);
net = init(net);
net = train(net,x,t);
net.divideFcn = 'dividerand'; % Divide data randomly
net.divideMode = 'sample'; % Divide up every sample
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
net.trainparam.max_fail=10;
% Train the Network
[net,tr] = train(net,inputs,targets);
% Test the Network
outputs = net(inputs);
errors = gsubtract(targets,outputs);
performance = perform(net,targets,outputs);
end
W = outputs / [ ones(1,N) ; x ];
y = W*[ ones(1,N) ;x ];
view(net)

Best Answer

Search the NEWSGROUP and ANSWERS with
newff Ntrials
Hope this helps
Thank you for formally accepting my ANSWER
Greg