How can I write a function that takes one scalar input(tens or ones place) and it prints the name of the value?
5 views (last 30 days)
Show older comments
What I intend is to use the MATAB built-in-function floor to determine if the number is a whole number, and it can also be employed to determine the value of the digit in the tens place and the value in the ones place.
0 Comments
Answers (1)
Rafael Müller
on 5 Mar 2018
Hi Paul
I suggest using
mod(x,1) == 0
Instead of `floor` because it detects NaN and Inf as not whole number. Finally to get the digits use the following code:
tenPlace = floor(x/10)
oncePlace = rem(x, 10)
0 Comments
See Also
Categories
Find more on Special Characters in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!