Extracting numerator and denominator values from a decimal value

I want matlab to automatically extract numerator and denominator values from a decimal value when I enter one.
For example, I entered a value R (Variable) = 6.52 , so matlab should automatically assign L (Numerator) = 652 and M (Denominator) = 100 .
Basically, I'm doing Resampling in Digital Signal Processing course, and whenever I enter the value of resampling factor, I want matlab to automatically extract Interpolation (L) and Decimation (M) factors from that value, for further processing (manual resampling).

More Answers (0)

Products

Release

R2021b

Community Treasure Hunt

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

Start Hunting!