Replacing arrays within a matrix

1 次查看(过去 30 天)
Rob
Rob 2018-2-27
回答: KSSV 2018-2-27
Really quick question.
How do I replace in one command for instance, in a matrix of 4x4, the first two rows by a vector v, and the other two rows by a vector u?

回答(1 个)

KSSV
KSSV 2018-2-27
As you are replacing all the elements of the matrix..why you want to go for replace? You create a different matrix itself.....
u = rand(1,4) ;
v = rand(1,4) ;
iwant = [u ; u ;v ;v ]

类别

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