My goal is to find all divisors of 30 and put them in a vector. My code right now looks like:
k=[];
c=[1:1:30];
for i=1:30
if mod(30,c(i))==0
v=[c(i)]
end
end
I am successful in finding the divisors of 30, but the output is:
v =
v =
v =
v =
I want to put all of the divisors in one single vector v, what am I missing? I have tried searching for answers but I could not find any, maybe because I don't understand MATLAB code well enough.
Thank you for your help!