Convert float numbers (double) to fractions (string)

Version 1.0.0 (1.61 KB) by Yumeng
Convert signed float numbers to signed fractions as strings. Matrix-compatible.
15 Downloads
Updated 2 Feb 2021

View License

R = double2fraction(X,tol) returns a cell array R containing strings of signed fractions for double numbers stored in N-dimensional matrix X and within an optional tolerance tol (default 0.01).
Does basically the same job as R = rats(X), but rats takes the string length as a restricting condition, while the provided function takes the absolute error tolerance.
See example.m for usage.

Cite As

Yumeng (2024). Convert float numbers (double) to fractions (string) (https://www.mathworks.com/matlabcentral/fileexchange/86800-convert-float-numbers-double-to-fractions-string), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2020b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0