use count000 = zeros(5,1); which declares a vector of 5 elements initialized at 0. Now, you can loop:
for i=1:5
count000(i) = blablabla...
end
And make sure that xyz_values(:,2) is also a vector, by declaring xyz_values to be a 3dimensional matrix instead of 2D.
Even better, now you can keep only one variable for all count000, count025, etc... by using
count = zeros(5,22);
for i=1:5
for j=1:22
count(i,j) = blablabla...
end
bar(i,:)
end
The (j-1)*0.025 gives you 0.00, 0.025, 0.050 etc as appropriate. By using two loops, you can reduce the size of the code pretty much :)
Best Answer