How Can I convert a 1 by 1 array into multidimensional array?

1 次查看(过去 30 天)
For example i have
a=[1]
I want to convert it into
a=[1111 1111 1111
1111 1111 1111
1111 1111 1111]
Can anyone please help me here.

回答(2 个)

Star Strider
Star Strider 2017-7-5
One approach:
a = [1];
a = a*ones(1, 36);
a = reshape(a, [], 4);

Walter Roberson
Walter Roberson 2017-7-5
repmat(a, 3, 4, 3)
perhaps

类别

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