フィルターのクリア

Matrix conversion

2 ビュー (過去 30 日間)
Muthuraj V
Muthuraj V 2012 年 1 月 11 日
how to get a matrix of the form from a given matrix, for exapmle
a= [2 3 4
5 6 7
8 9 0]
i want a matrix where in each elements are repeated in other matrix as follows
b= [2 2 3 3 4 4
2 2 3 3 4 4
5 5 6 6 7 7
5 5 6 6 7 7
8 8 9 9 0 0
8 8 9 9 0 0]

採用された回答

Chandra Kurniawan
Chandra Kurniawan 2012 年 1 月 11 日
I= [2 3 4;
5 6 7;
8 9 0];
[m n] = size(I);
ShX = 2;
ShY = 2;
r = m*ShX;
c = n*ShY;
J = zeros(r,c);
for x = 1 : m
for y = 1 : n
J((x-1)*ShX+1 : x*ShX, (y-1)*ShY+1 : y*ShY) = I(x,y);
end
end
  1 件のコメント
Muthuraj V
Muthuraj V 2012 年 1 月 11 日
Thanks a lot,,,

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

その他の回答 (1 件)

Andrei Bobrov
Andrei Bobrov 2012 年 1 月 11 日
a = [2 3 4
5 6 7
8 9 0];
b = kron(a,[1 1;1 1])

カテゴリ

Help Center および File ExchangeFeature Detection and Extraction についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by