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

17 次查看(过去 30 天)
mina
mina 2013-3-2
ones(size(data, 2), 1) , what mean??

回答(1 个)

Wayne King
Wayne King 2013-3-2
编辑:Wayne King 2013-3-2
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

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by