function z = mysub(x,y)
z = num2str( str2num(x) - str2num(y) );
why this is not working for this code?
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 = ['+' ...]
piece of cake
string to double and sprintf
Need to calculate the difference ... not the sum! :)
Sorry for this...just had to try regexp. Somehow, the size of this is calculated completly wrong.....
Back to basics 15 - Benchmark
Back to basics 9 - Indexed References
Generate a NaN...on purpose
multiply by three
Calories in a slice of pizza?
Simple spirometer - find your lung capacity from the number and size of soap bubbles in one breath
cos for boss?
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office