How to remove second digit of first a column
Afficher commentaires plus anciens
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 commentaire
Réponses (2)
James Tursa
le 24 Jan 2017
Modifié(e) : James Tursa
le 24 Jan 2017
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 commentaires
Vishal Sharma
le 24 Jan 2017
Image Analyst
le 24 Jan 2017
Why do you need this quirky, unusual thing?
Stephen23
le 24 Jan 2017
>> rem(A,10)
ans =
1 2
4 3
3 4
Catégories
En savoir plus sur Sparse Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!