Borrar filtros
Borrar filtros

ones(size(data, 2), 1) , what mean??

14 visualizaciones (últimos 30 días)
mina
mina el 2 de Mzo. de 2013
ones(size(data, 2), 1) , what mean??

Respuestas (1)

Wayne King
Wayne King el 2 de Mzo. de 2013
Editada: Wayne King el 2 de Mzo. de 2013
Create a vector of ones which has the number of rows equal to the number of columns in the matrix data and 1 column
So if data is 100x10
data = randn(100,10);
then
y = ones(size(data,2),1);
creates a vector y that is 10x1.
If data is 100x1000
then
y = ones(size(data,2),1);
creates a vector of 1s that is 1000x1

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by