Borrar filtros
Borrar filtros

reshape matrix

1 visualización (últimos 30 días)
itsik
itsik el 27 de Mayo de 2011
i have this matrix 00001110000 00001110000 00001110000 and i want to make it like that
11100000000
11100000000
11100000000
how to do that?
thanks!

Respuesta aceptada

Oleg Komarov
Oleg Komarov el 27 de Mayo de 2011
Note that the way you indicated your input it looks like a char array. I inferred from your duplicate post that it is a double matrix (you should separate elements)
A = [0 0 0 0 1 1 1 0 0 0 0
0 0 0 0 1 1 1 0 0 0 0
0 0 0 0 1 1 1 0 0 0 0];
Two solutions:
A(:,[5:end 1:4])
or
circshift(A,[1 -4])

Más respuestas (2)

itsik
itsik el 27 de Mayo de 2011
this is the first matrix
00001110000
00001110000
00001110000
  1 comentario
Oleg Komarov
Oleg Komarov el 27 de Mayo de 2011
Please edit your original post, don't add answers.

Iniciar sesión para comentar.


itsik
itsik el 27 de Mayo de 2011

thank u so much my friend and i have another question how do i filter all the zeros so i can get only

A=   111
     111
     111

thank u so much!

  1 comentario
Walter Roberson
Walter Roberson el 27 de Mayo de 2011
A(:,any(A))

Iniciar sesión para comentar.

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by