## Trending News

### 2 Answers

- Anonymous2 decades agoFavorite Answer
你在格式化輸出有以下格式可以選擇

Specifier Description

%c ------- Single character

%d ------- Decimal notation (signed)

%e -------- Exponential notation (using a lowercase e as in 3.1415e+00)

%E ------- Exponential notation (using an uppercase E as in 3.1415E+00)

%f -------- Fixed-point notation

%g -------- The more compact of %e or %f, as defined in [2]. Insignificant zeros do not print.

%G -------- Same as %g, but using an uppercase E

%i --------- Decimal notation (signed)

%o -------- Octal notation (unsigned)

%s -------- String of characters

%u --------- Decimal notation (unsigned)

%x --------- Hexadecimal notation (using lowercase letters a-f)

%X --------- Hexadecimal notation (using uppercase letters A-F)

你給一個矩陣

例如一個3*3矩陣

a=[1 2 3;4 5 6;7 8 9];

你可以利用

fprintf('a=%?',a)

將 ? 填入上面可用的格式

所有的格式都無法達成你的要求

印出一矩陣

可以利用非格式化輸出

disp(a)

就可以得到一個矩陣

>> disp(a)

1 2 3

4 5 6

7 8 9

或者乾脆直接鍵入

a

也可以得到一個矩陣

a =

1 2 3

4 5 6

7 8 9

Source(s): 我