?? 05-01.txt
字號(hào):
>> str='I have many good friends!'
str =
I have many good friends!
>> whos
Name Size Bytes Class
EXPLODE 1x5 40 double array
F1 1x12 24 char array
F2 1x12 24 char array
X 1x5 40 double array
a 1x28 224 double array
ans 1x12 12 logical array
label 1x5 330 cell array
s1 1x10 20 char array
s2 1x10 20 char array
s3 1x11 22 char array
str 1x25 50 char array
w 1x19 38 char array
x 1x4 32 double array
Grand total is 173 elements using 876 bytes
>>
%另外,字符串內(nèi)的單引號(hào)是由兩個(gè)連續(xù)的單引號(hào)來(lái)表示。字符串連接可以直接從數(shù)組連接中得到。繼續(xù)在命令窗口中輸入如下語(yǔ)句,并按Enter鍵確認(rèn)。
>>u='we must study hard!'
u =
we must study hard!
>> v='and we should never forget our country!'
v =
and we should never forget our country!
>> w=[u,v]
w =
we must study hard!and we should never forget our country!
>>
%如同矩陣,字符串可以有多個(gè)行,但每行必須有相同數(shù)目的列數(shù)。因此,要用空格以使所有行有相同長(zhǎng)度,繼續(xù)在命令窗口中輸入如下語(yǔ)句,并按Enter鍵確認(rèn)。
>> t=[' xiao ming kao shang le daxue'
'xiaofang meiyou kaoshangdaxue']
t =
xiao ming kao shang le daxue
xiaofang meiyou kaoshangdaxue
>>
%如果各列輸入的字符串長(zhǎng)度不一致時(shí),MATLAB 7將給出錯(cuò)誤的提示。繼續(xù)在命令窗口中輸入如下語(yǔ)句,并按Enter鍵確認(rèn)。
>> t=[' xiao ming kao shang le daxue'
'xiaofang meiyou kaoshang daxue']
??? Error using ==> vertcat
All rows in the bracketed expression must have the same
number of columns.
>>
>> t=['China win 32 gold metals in the Olympic Games'
'and Chinese TAibei Team win 2 gold metals '
'That doesn''t mean any thing ']
t =
China win 32 gold metals in the Olympic Games
and Chinese TAibei Team win 2 gold metals
That doesn't mean any thing
>>
>> t=['China win 32 gold metals in the Olympic Games'
'and Chinese TAibei Team win 2 gold metals '
'That doesn''t mean any thing ']
??? Error using ==> vertcat
All rows in the bracketed expression must have the same
number of columns.
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -