how to remove a column from a character matrix?

1 visualización (últimos 30 días)
aditya kumar sahu
aditya kumar sahu el 6 de Dic. de 2016
Comentada: aditya kumar sahu el 6 de Dic. de 2016
suppose
x= 1001
1001 (x is a character matrix)
i want y=100
100 (last column is removed)

Respuesta aceptada

KSSV
KSSV el 6 de Dic. de 2016
x= '1001 1001' ;
idx = strfind(x,' ') ; % get space position
x(idx-1) = [] ;
x(end) = []
  3 comentarios
KSSV
KSSV el 6 de Dic. de 2016
x= ['1001' ;
'1001'] ;
x(:,end) =[]
aditya kumar sahu
aditya kumar sahu el 6 de Dic. de 2016
Thank you its worked

Iniciar sesión para comentar.

Más respuestas (1)

Guillaume
Guillaume el 6 de Dic. de 2016
You remove the last column of any matrix, regardless of what type of data it contains, even characters, the same way with:
yourmatrix(:, end) = [];
Unless what you call a character matrix is not a character matrix actually. A character matrix would be:
x = ['1001';'0110']; %for example
  1 comentario
aditya kumar sahu
aditya kumar sahu el 6 de Dic. de 2016
Dear guillaume thank you,.. but it is not working it is showing empty matrix

Iniciar sesión para comentar.

Categorías

Más información sobre Image Segmentation and Analysis 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