- #1
TheloniousMONK
- 16
- 0
I am pretty new to MATLAB and am having a problem formatting my output. I have two questions:
1. How do I display the sign of a number in front of it similar to showpos in C++? For example, if a = 72, I want to display '+72', but if a = -72, I do not want to display '+-72'.
2. Is there a way to make it make imaginary output use j instead of i without doing something like:
num2str( real(Comp1) , '%.3f' ) + num2str( imag(Comp1) , '%.3fj' )
Any help would be greatly appreciated.
1. How do I display the sign of a number in front of it similar to showpos in C++? For example, if a = 72, I want to display '+72', but if a = -72, I do not want to display '+-72'.
2. Is there a way to make it make imaginary output use j instead of i without doing something like:
num2str( real(Comp1) , '%.3f' ) + num2str( imag(Comp1) , '%.3fj' )
Any help would be greatly appreciated.