Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
18
Добавлен:
09.02.2015
Размер:
195.07 Кб
Скачать

Input parameters:

M: any one of a char row vector, 2D char array, or an N-D cell array of

strings.

RETURN PARAMETERS:

M: any one of a char row vector, 2D char array or an N-D cell array of

strings.

EXAMPLES:

M = STRTRIM(M) removes whitespace from the front and rear of M.

See also isspace, cellstr, deblank.

Reference page in Help browser

doc strtrim

<upper> - Convert string to uppercase.

UPPER Convert string to uppercase.

B = UPPER(A) converts any lower case characters in A to

the corresponding upper case character and leaves all

other characters unchanged.

B = UPPER(A), when A is a cell array of strings, returns a cell array

the same size as A containing the result of applying UPPER to each

string in A.

Character sets supported:

PC : Windows Latin-1

Other: ISO Latin-1 (ISO 8859-1)

: Also supports 16-bit character sets.

See also lower.

Reference page in Help browser

doc upper

<lower> - Convert string to lowercase.

LOWER Convert string to lowercase.

B = LOWER(A) converts any uppercase characters in A to

the corresponding lowercase character and leaves all

other characters unchanged.

B = LOWER(A), when A is a cell array of strings, returns a cell array

the same size as A containing the result of applying LOWER to each

string in A.

Character sets supported:

PC : Windows Latin-1

Other: ISO Latin-1 (ISO 8859-1)

: Also supports 16-bit character sets.

See also upper.

Reference page in Help browser

doc lower

Character set conversion

<native2unicode> - Convert bytes to Unicode characters.

NATIVE2UNICODE Convert bytes to Unicode characters.

UNICODESTR = NATIVE2UNICODE(BYTES) takes a vector containing

numeric values in the range [0,255] and converts these values

as a stream of 8-bit bytes to Unicode characters. The stream

of bytes is assumed to be in MATLAB's default character

encoding scheme. The Unicode characters are returned in the

char vector UNICODESTR with the same general array shape as

BYTES. You can use the function FREAD to generate input to

this function.

UNICODESTR = NATIVE2UNICODE(BYTES,ENCODING) does the conversion

with the assumption that the byte stream is in the character

encoding scheme specified by the string ENCODING. ENCODING must

be the empty string ('') or a name or alias for an encoding

scheme. Some examples are 'UTF-8', 'latin1', 'US-ASCII', and

'Shift_JIS'. For common names and aliases, see the Web site

http://www.iana.org/assignments/character-sets. If ENCODING is

unspecified or is the empty string (''), MATLAB's default

encoding scheme is used.

If BYTES is a CHAR vector, it is returned unchanged.

For example,

fid = fopen('japanese.txt');

b = fread(fid,'*uint8')';

fclose(fid);

str = native2unicode(b,'Shift_JIS');

disp(str);

reads and displays some Japanese text. For the final command,

disp(str), to display this text correctly, the contents of str

must consist entirely of Unicode characters. The call to

NATIVE2UNICODE converts text read from the file to Unicode and

returns it in str. The Shift_JIS argument ensures that str

contains the same string on any computer, regardless of how it

is configured for language. Note that the computer must be

configured to display Japanese (e.g. a Japanese Windows machine)

for the output of disp(str) to be correct.

Here is an equivalent way to read and display Japanese text, again

assuming that the computer is configured to display Japanese:

fid = fopen('japanese.txt', 'r', 'n', 'Shift_JIS');

str = fread(fid, '*char')';

fclose(fid);

disp(str);

See also unicode2native.

Reference page in Help browser

doc native2unicode

<unicode2native> - Convert Unicode characters to bytes.

UNICODE2NATIVE Convert Unicode characters to bytes.

BYTES = UNICODE2NATIVE(UNICODESTR) takes a char vector of Unicode

characters, UNICODESTR, converts it to MATLAB's default character

encoding scheme, and returns the bytes as a uint8 vector BYTES. The

output vector, BYTES, has the same general array shape as UNICODESTR.

You can save the output of UNICODE2NATIVE in a file using FWRITE.

BYTES = UNICODE2NATIVE(UNICODESTR,ENCODING) converts the Unicode

characters to the character encoding scheme specified by the string

ENCODING. ENCODING must be the empty string ('') or a name or alias

for an encoding scheme. Some examples are 'UTF-8', 'latin1',

'US-ASCII', and 'Shift_JIS'. For common names and aliases, see the

Web site http://www.iana.org/assignments/character-sets. If ENCODING

Соседние файлы в папке Библиотеки Matlab