Left digits
이전 댓글 표시
if I have a number such as 1234, how can I select the left 3 digits 123?
채택된 답변
추가 답변 (2개)
Walter Roberson
2011년 6월 14일
You can do it arithmetically with something like
floor(x ./ 10.^ceil(log10(x+1)-3))
provided the values are at least 100
Paulo Silva
2011년 6월 14일
n=num2str(1234)
n1=str2num(n(1:end-1))
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!