Given a real number r, write the function rDigitizer that breaks r into constituent digits and symbols.
For example:
>> rDigitizer(1234.56)
>> ans =
[1 2 3 4 '.' 5 6]
>>
>> rDigitizer(-round(pi,4))
>> ans =
['-' 3 '.' 1 4 1 6]
>>
>> rDigitizer(floor(exp(1)))
>> ans =
2
-------------
NOTE: The following restrictions apply:
- The function should only have one (1) line of code, excluding the function start line.
- Semicolons (;) are considered end-of-line characters.
- Please suppress the function end line. Keyword 'end' is not allowed.
- Importing libraries is not allowed.
- Regular expressions, base conversion and string manipulation are not allowed.
Solution Stats
Solution Comments
Show comments
Loading...
Problem Recent Solvers3
Suggested Problems
-
Replace NaNs with the number that appears to its left in the row.
3072 Solvers
-
Longest run of consecutive numbers
6763 Solvers
-
The sum of the numbers in the vector
649 Solvers
-
Create an index-powered vector
966 Solvers
-
Natural numbers in string form
1968 Solvers
More from this Author116
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!