make empty row matrix in matlab

To create an empty row matrix in Matlab, you can use the zeros or ones function depending on whether you want an all-zero or all-one matrix:

main.m
% initializing an empty row matrix with zeros
row_matrix = zeros(1, n);

% initializing an empty row matrix with ones
row_matrix = ones(1, n);
143 chars
6 lines

In both cases, n is the number of columns in the matrix. The first argument of the zeros and ones function is the number of rows, which is 1 in this case.

gistlibby LogSnag