To create a vector with a certain size and initialize all its entries to a particular value, such as 800 in this case, we can make use of the function ones()
. The ones()
function creates an array of ones having the same size as the input size.
Here's the code to create a vector of size n with all entries equal to 800.
main.m47 chars3 lines
This creates a row vector that is 1xn
, filled with the value 800
.
gistlibby LogSnag