How can I write a function that takes one scalar input(tens or ones place) and it prints the name of the value?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Rafael Müller
el 5 de Mzo. de 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 comentarios
Ver también
Categorías
Más información sobre Special Characters en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!