フィルターのクリア

how do i place a matrix on top of each other using repmat

4 ビュー (過去 30 日間)
Oscar Tsang
Oscar Tsang 2019 年 1 月 26 日
コメント済み: madhan ravi 2019 年 1 月 27 日
I have 3 matrix's. Matrix Z1 with 5 rows and 5 columns of zeros, matrix Z2 with 5 rows and 10 columns of ones. And, matrix Z3 with 3 identical rows, each row containing the integers from 0 to 14. My aim is to have a matrix z that z1 and z2 will be tiles on top of matrix z3. I tried to combine both z1 and z2 into a matrix x then using repmat comand to put z3 matrix as the bottom tile. I don't know if im using the wrong command even.
The exspected output is this:
0 0 0 0 0 1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 1 1 1 1 1 1 1 1 1 1
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Any help is appriciated!! :)

採用された回答

madhan ravi
madhan ravi 2019 年 1 月 26 日
z1=zeros(5);
z2=ones(5,10);
z3=repmat(0:14,5,1); % proper usage
Result=[z1 z2;z3] % concatenate z1 , z2 horizontally & z3 vertically.
  2 件のコメント
Oscar Tsang
Oscar Tsang 2019 年 1 月 26 日
when you did z1=zeros(5);. Why is it that when I chnage zeros to threes it won't work??
madhan ravi
madhan ravi 2019 年 1 月 27 日
Because there exists no such function named as threes,
doc ones
doc zeros

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by