필터 지우기
필터 지우기

How to remove second digit of first a column

조회 수: 1 (최근 30일)
Vishal Sharma
Vishal Sharma 2017년 1월 24일
편집: James Tursa 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
Jan
Jan 2017년 1월 24일
편집: Jan 2017년 1월 24일
What do you want for the inputs 123 and -2? Do you really want to remove the first digit, or to obtain the second digit, or to keep the digit smaller than 10?

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

답변 (2개)

James Tursa
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
Vishal Sharma
Vishal Sharma 2017년 1월 24일
I want to retain second digit not the first one ....
Image Analyst
Image Analyst 2017년 1월 24일
Why do you need this quirky, unusual thing?

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


Stephen23
Stephen23 2017년 1월 24일
>> rem(A,10)
ans =
1 2
4 3
3 4

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by