7

How can I change the format to NOT display a matrix like this:

 1.0e+003 *

3.1251         0         0         0         0         0         0         0         0         0
     0    3.1251         0         0         0         0         0         0         0         0
     0         0    3.1251         0         0         0         0         0         0         0
     0         0         0    3.1251         0         0         0         0         0         0
     0         0         0         0    3.1251         0         0         0         0         0
     0         0         0         0         0    3.1251         0         0         0         0
     0         0         0         0         0         0    3.1251         0         0         0
     0         0         0         0         0         0         0    3.1251         0         0
     0         0         0         0         0         0         0         0    3.1251         0
     0         0         0         0         0         0         0         0         0    3.1251

but instead to include the 1.0e+003 into every double so that the matrix looks like 3125 along the diagonal?

gnovice
  • 125,304
  • 15
  • 256
  • 359
tim
  • 9,896
  • 20
  • 81
  • 137

1 Answers1

8

You can get the output you want if you change the format to shortG (based on Example 5 of the documentation):

>> format shortG
>> 3125.1234.*eye(5)   %# Display a sample matrix similar to yours

ans =

       3125.1            0            0            0            0
            0       3125.1            0            0            0
            0            0       3125.1            0            0
            0            0            0       3125.1            0
            0            0            0            0       3125.1
gnovice
  • 125,304
  • 15
  • 256
  • 359