How to create matrix with array under certain conditions?

1 次查看(过去 30 天)
I have an array:
A=[1.3 1.2 1.3]
How can I get matrix B using A?
B=[1.3 1.3 1.3; 1.3 1.2 1.3; 1.3 1.3 1.3]
Matrix B has the value of A at the central row,column,and diagonal.

采纳的回答

Chandrasekhar
Chandrasekhar 2013-5-3
B = [ones(1,3)*A(1); A; ones(1,3)*A(1)]

更多回答(0 个)

类别

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

标签

Community Treasure Hunt

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

Start Hunting!

Translated by