I'm trying to initialize an array in matlab of ninety zero's. However, I don't want to write 90 consecutive zeros after even = [ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...... ] etc.
1 Answer
Use the zeros function.
E.g. x = zeros(1,90)
7 Comments
Jacob
@pst: Use the
ones function. x = 42*ones(1,90).Ben Voigt
@pst:
42 * ones(1,90). Or repmat([1], 1, 90).Jacob
@pst: This is how we generate matrices of a single number. For more complicated replication, we use
repmat.Smash
@ Ben: you mean
repmat([42], 1, 90) :) |