フィルターのクリア

how to remove a column from a character matrix?

1 回表示 (過去 30 日間)
aditya kumar sahu
aditya kumar sahu 2016 年 12 月 6 日
コメント済み: aditya kumar sahu 2016 年 12 月 6 日
suppose
x= 1001
1001 (x is a character matrix)
i want y=100
100 (last column is removed)

採用された回答

KSSV
KSSV 2016 年 12 月 6 日
x= '1001 1001' ;
idx = strfind(x,' ') ; % get space position
x(idx-1) = [] ;
x(end) = []
  3 件のコメント
KSSV
KSSV 2016 年 12 月 6 日
x= ['1001' ;
'1001'] ;
x(:,end) =[]
aditya kumar sahu
aditya kumar sahu 2016 年 12 月 6 日
Thank you its worked

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

その他の回答 (1 件)

Guillaume
Guillaume 2016 年 12 月 6 日
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 件のコメント
aditya kumar sahu
aditya kumar sahu 2016 年 12 月 6 日
Dear guillaume thank you,.. but it is not working it is showing empty matrix

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

Community Treasure Hunt

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

Start Hunting!

Translated by