roundfrac

버전 1.0.0.0 (17.8 KB) 작성자: Chad Greene
Round numbers to nearest fraction.
다운로드 수: 451
업데이트 날짜: 2015/1/6

라이선스 보기

This function rounds inputs to multiples of a fraction. For example, to round values in an array x to the nearest fifth, use roundfrac(x,1/5).

Syntax
Xrounded = roundfrac(X,fraction)
Xrounded = roundfrac(X,fraction,option)

Description
Xrounded = roundfrac(X,fraction) rounds X to multiples of nearest fraction. If fraction is a scalar, it is applied to all values in X. If dimensions of fraction match dimensions of X, it is applied element-wise. If fraction is 1/3, values of X are rounded to the nearest one third. roundfrac(X,1) is equivalent to round(X).

Xrounded = roundfrac(X,fraction,option) specifies an option string as 'floor', 'ceil', 'fix', or 'round'. Default rounding option is 'round'.

인용 양식

Chad Greene (2024). roundfrac (https://www.mathworks.com/matlabcentral/fileexchange/48965-roundfrac), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2012b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Arithmetic Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

roundfrac/html/

버전 게시됨 릴리스 정보
1.0.0.0