-
2 Comments
Pasumarthi Viswanath
on 11 Nov 2012
please explain why the digits get separated when (num2str(2^n)-'0') is performed
Cris Luengo
on 12 Nov 2012
num2str converts the integer number into a string representation of that number: 1234 becomes '1234', which is the same as ['1','2','3','4']. Now you've got one array entry per digit. Subtract '0' from there, then the char array will become a double array with value 0 where the char was '0', etc.
Suggested Problems
-
1744 Solvers
-
Find state names that start with the letter N
1314 Solvers
-
Arrange Vector in descending order
11942 Solvers
-
Change the sign of even index entries of the reversed vector
575 Solvers
-
Matlab Basics - Absolute Value
633 Solvers
More from this Author96
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!