1

I made a script which produces a variable k, which holds results in a 9x5 matrix. All these results are complex numbers. I wanted to display the table the best way I could etc. with row and column headers. The column headers are supposed to be variables such as x+y, x*z, x/y etc.

I tried to use

array2table()

but the function does not accept headers such as x+y, xz because signs such as "+"and "" are not accepted.

Then I tried to use

printmat()

which does accept the signs but only prints out the real values.. it does not work with complex numbers, it's really getting annoying now

Is there any other way to display a matrix of complex numbers, with row header and columns, etc? Or can I still change printmat to include the imaginary numbers?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
anony
  • 79
  • 1
  • 2
  • 10
  • I don't have a recent version of matlab which includes this function, but I would assume that the problem is caused by `fprintf` which does not support complex numbers. My suggestion: Open the file using `edit printmat` and see if you can fix it. `num2str` supports complex numbers. To avoid problems don't modify the original, create your own copy. – Daniel Nov 17 '15 at 21:45
  • There is a duplicate thread with an answer doing exactly what I suggested. – Daniel Nov 17 '15 at 21:48

0 Answers0