How can I control the display of a double matrix in MATLAB?
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?
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
精彩评论