MATLAB: How to repeat a for loop n times

arrayfor loopMATLABmatrixmatrix array

end
States
Basically it outputs an array of size (N,1) consisting of 1s and -1s.
How can I repeat this array for example 5 times using the updated values of 'States', whilst displaying the results of each loop?

Best Answer

Is this all you are trying to do?
n = number of times to repeat the loop
States = zeros(size(N,1));
for k=1:n
for ii = 1:numel(AgentZScore)
% etc
end
States
end