How can I write a function that takes one scalar input(tens or ones place) and it prints the name of the value?
5 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Rafael Müller
2018 年 3 月 5 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Special Characters についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!