trimming numbers
조회 수: 4 (최근 30일)
이전 댓글 표시
how can I trim numbers in matlab (similar to the left and right functions in excel). For example, if: A=[3829 3620 3714] and i want to get the first two digits: to get B=[38 36 37], how can i do so?
댓글 수: 0
채택된 답변
Oleg Komarov
2011년 7월 2일
A = [3829 36203 371];
% Robust to different 'lengths'
fix(A ./ 10.^(ceil(log10(abs(A)))-2))
댓글 수: 0
추가 답변 (1개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!