I am pretty new to MATLAB and am having a problem formatting my output. I have two questions:(adsbygoogle = window.adsbygoogle || []).push({});

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.

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Quick MATLAB Question

Loading...

Similar Threads - Quick MATLAB Question | Date |
---|---|

(quick) Matlab fprintf question | Aug 23, 2012 |

A quick question regarding matlab | Oct 3, 2011 |

Matlab quick question | Dec 1, 2009 |

Quick matlab question | Jun 2, 2008 |

Matlab -> quick question | Mar 28, 2008 |

**Physics Forums - The Fusion of Science and Community**