Azzera filtri
Azzera filtri

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

4 visualizzazioni (ultimi 30 giorni)
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!! :)

Risposta accettata

madhan ravi
madhan ravi il 26 Gen 2019
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 Commenti
Oscar Tsang
Oscar Tsang il 26 Gen 2019
when you did z1=zeros(5);. Why is it that when I chnage zeros to threes it won't work??
madhan ravi
madhan ravi il 27 Gen 2019
Because there exists no such function named as threes,
doc ones
doc zeros

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by