You are on page 1of 12

:

-
:
-1-5
:
:
;>> s=This is a character string
)>> size(s
=ans
1 26
:
.

-
:
-2-5 : abs
abs :
>> s= Hello
)>> u=abs(s
=u
72 101 108 108 111

-
:
-3-5
char .
>> s= Hello
)>> u=abs(s
=u
72 101 108 108 111
)>> sNew=char(u
=sNew
Hello

-
:
-4-5
.
.
.
:
>> s= Hello
;)>> sInv=s( end : -1 : 1
)>>disp(sInv
olleH

-
:
-5-5 ( )
] [ ;
. :
]>> sm=[This is first line ; This is second line
??? Error using ==> vertcat
All rows in the bracketed expression must have the same
number of columns.
>> sm=[This is first line
;]This is second line

-
:
-6-5 ( )
char:
; >> line1=This is first line
;>> line2= This is second line
)>>sm=char(line1,line2
=sm
This is first line
This is second line

-
:
-7-5
input
:
.
. .
input s
.

-
:
-- -7-5
:
>>s=input(Please answer Yes or No: )
Please answer Yes or No: No
s=
No
----------------------
>>s=input(Please answer Yes or No: ,s)
Please answer Yes or No: No
s=
No
-
:
-8-5
1 0 strcmp(s1,s2) :
upper :
lower :
num2str :
str2num :
mat2str :
eval :

: num2str mat2str
eval.

-
:
...- -8-5
:
>> a=input(Enter <a> value= );
enter <a> value= 12

>> disp([You number is, num2str(a) , . Thank


you!]);

Your number is 12 . Thank you!

-
:
:- x y
. x y
.
:-
.
:- - .

You might also like