Info

此问题已关闭。 请重新打开它进行编辑或回答。

How to remove second digit of first a column

2 次查看(过去 30 天)
Vishal Sharma
Vishal Sharma 2017-1-24
关闭: Stephen23 2017-1-24
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 个评论
Stephen23
Stephen23 2017-1-24
Duplicate:
https://www.mathworks.com/matlabcentral/answers/321691-how-to-remove-second-digit-of-first-a-column

回答(1 个)

KSSV
KSSV 2017-1-24
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

此问题已关闭。

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by