Assume the following numbers in a table
1
2
3
4
How can I multiply them in the following manner:
1
1
1
1
2
2
2
2
3
3
3
3
4
4
4
4
thanks

1 件のコメント

John D'Errico
John D'Errico 2014 年 11 月 14 日
You mean to replicate them, not multiply them. Multiplication is an arithmetic operation as I recall.

サインインしてコメントする。

 採用された回答

per isakson
per isakson 2014 年 11 月 14 日

1 投票

Try
x = [1;2;3;4];
reshape( repmat( transpose(x), [4,1]), [], 1 )

その他の回答 (3 件)

Matt J
Matt J 2014 年 11 月 14 日

1 投票

Another way,
x = [1;2;3;4];
result = x( ceil((1:length(x)*4)/4) );
Matt J
Matt J 2014 年 11 月 14 日

1 投票

kron([1;2;3;4], ones(4,1))
Matt J
Matt J 2014 年 11 月 14 日

1 投票

x=1:4;
result=ones(4,1)*x;
result=result(:);

カテゴリ

ヘルプ センター および File ExchangeTables についてさらに検索

質問済み:

AA
2014 年 11 月 14 日

回答済み:

2014 年 11 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by