채택된 답변

KSSV
KSSV 2016년 12월 6일

0 개 추천

x= '1001 1001' ;
idx = strfind(x,' ') ; % get space position
x(idx-1) = [] ;
x(end) = []

댓글 수: 3

u r code is working if i put all rows in a single row.but for 2 row it is fine if i have number of rows.then how to do
x= ['1001' ;
'1001'] ;
x(:,end) =[]
Thank you its worked

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Guillaume
Guillaume 2016년 12월 6일

0 개 추천

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

Dear guillaume thank you,.. but it is not working it is showing empty matrix

댓글을 달려면 로그인하십시오.

질문:

2016년 12월 6일

댓글:

2016년 12월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by