Problem 564. How to subtract?
Solution Stats
Problem Comments
-
7 Comments
good
function z = mysub(x,y)
z = num2str( str2num(x) - str2num(y) );
end
why this is not working for this code?
Nice
Hi. My code only prints out '-' for a negative number but not '+' for a positive. Can anyone help? function Z = mysub(X,Y); W = (str2num(X))-(str2num(Y)); Z = num2str(W); end
actually each of them has 14 characters or less...15 if we count the signs.
Mark Sanderson, if W > 0 Z = ['+' ...]
how about solving this problem but not using any conversion functions like num2str , str2num , str2double ...
Solution Comments
Show commentsProblem Recent Solvers1489
Suggested Problems
-
Find the sum of the elements in the "second" diagonal
1106 Solvers
-
Back to basics 6 - Column Vector
1019 Solvers
-
Are all the three given point in the same line?
369 Solvers
-
Deleting an element in a matrix
445 Solvers
-
7298 Solvers
More from this Author100
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!