Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

How to remove second digit of first a column

2 views (last 30 days)
Vishal Sharma
Vishal Sharma on 24 Jan 2017
Closed: Stephen23 on 24 Jan 2017
I have one matrix A = [21 2; 34 3; 13 4] I want to remove first digit of first column, so that result shall be A= [1 2;4 3; 3 4]
  1 Comment
Stephen23
Stephen23 on 24 Jan 2017
Duplicate:
https://www.mathworks.com/matlabcentral/answers/321691-how-to-remove-second-digit-of-first-a-column

Answers (1)

KSSV
KSSV on 24 Jan 2017
A = [21 2; 34 3; 13 4] ;
B= [1 2;4 3; 3 4] ;
iwant = A ;
for i = 1:size(A,1)
tmp=str2double(regexp(num2str(A(i,1)),'\d','match')) ;
iwant(i,1) = tmp(2) ;
end
iwant

This question is closed.

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!