MATLAB: Replication factors must be a row vector of integers or integer scalars.

repmat

My coding is
depth = [0.01 1.5:1.5:30]';
w = 10 – 0.5 .* depth;
w(w<0) = 0;
a=829862;
b=21
c=a/b
W = repmat(w,c,1);
The result is replication factors must be a row vector of integers or integers scalars
Does any one can help me?

Best Answer

c must be an integer. Then, a solution:
depth = [0.01 1.5:1.5:30]';
w = 10 - 0.5 .* depth;
w(w<0) = 0;
a=829862;
b=21
c=round(a/b)
W = repmat(w,c,1);