How to remove second digit of first a column
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (2 件)
James Tursa
2017 年 1 月 24 日
編集済み: James Tursa
2017 年 1 月 24 日
To retain the 1st digit for the numbers shown:
result = [floor(A(:,1)/10) A(:,2)];
To retain the 2nd digit for the numbers shown:
result = [mod(A(:,1),10) A(:,2)];
If numbers can be > 99 or negative, then you will have to let us know what you want for output.
2 件のコメント
参考
カテゴリ
Help Center および File Exchange で Entering Commands についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!