Borrar filtros
Borrar filtros

how can enlarge a matrix?

10 visualizaciones (últimos 30 días)
jack nn
jack nn el 3 de Jun. de 2015
Comentada: jack nn el 4 de Jun. de 2015
hi I have some matrixes that I want to resize these in a way that every element repeated in a 5*5 Square for example: m=[1,2;3,4] and I want to my result be this:
1 1 1 1 1 2 2 2 2 2
1 1 1 1 1 2 2 2 2 2
1 1 1 1 1 2 2 2 2 2
1 1 1 1 1 2 2 2 2 2
1 1 1 1 1 2 2 2 2 2
3 3 3 3 3 4 4 4 4 4
3 3 3 3 3 4 4 4 4 4
3 3 3 3 3 4 4 4 4 4
3 3 3 3 3 4 4 4 4 4
3 3 3 3 3 4 4 4 4 4
..... I searched but imresize and reshape can not do this for me.Is there any way?

Respuesta aceptada

Stephen23
Stephen23 el 3 de Jun. de 2015
Editada: Stephen23 el 3 de Jun. de 2015
If you have MATLAB R2015a (or more recent) then you can use repelem.
Otherwise you could try this FEX submission:
Or else you have to calculate it yourself, the easiest way is to use kron:
>> m = [1,2;3,4];
>> n = 5;
>> kron(m,ones(n))
ans =
1 1 1 1 1 2 2 2 2 2
1 1 1 1 1 2 2 2 2 2
1 1 1 1 1 2 2 2 2 2
1 1 1 1 1 2 2 2 2 2
1 1 1 1 1 2 2 2 2 2
3 3 3 3 3 4 4 4 4 4
3 3 3 3 3 4 4 4 4 4
3 3 3 3 3 4 4 4 4 4
3 3 3 3 3 4 4 4 4 4
3 3 3 3 3 4 4 4 4 4
  1 comentario
jack nn
jack nn el 4 de Jun. de 2015
thanks Stephen Cobeldick.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by