MATLAB Programming

MATLAB Programming MATLAB Programming

cda.psych.uiuc.edu
from cda.psych.uiuc.edu More from this publisher
23.06.2015 Views

2 Data Types Function Summary MATLAB provides these functions for working with character arrays: • Functions to Create Character Arrays on page 2-64 • Functions to Modify Character Arrays on page 2-64 • Functions to Read and Operate on Character Arrays on page 2-65 • Functions to Search or Compare Character Arrays on page 2-65 • Functions to Determine Data Type or Content on page 2-65 • Functions to Convert Between Numeric and String Data Types on page 2-66 • Functions to Work with Cell Arrays of Strings as Sets on page 2-66 FunctionstoCreateCharacterArrays Function 'str' blanks sprintf strcat strvcat Description Create the string specifiedbetweenquotes. Create a string of blanks. Write formatted data to a string. Concatenate strings. Concatenate strings vertically. Functions to Modify Character Arrays Function deblank lower sort strjust strrep Description Remove trailing blanks. Make all letters lowercase. Sort elements in ascending or descending order. Justify a string. Replace one string with another. 2-64

Characters and Strings Functions to Modify Character Arrays (Continued) Function strtrim upper Description Remove leading and trailing white space. Make all letters uppercase. Functions to Read and Operate on Character Arrays Function eval sscanf Description Execute a string with MATLAB expression. Read a string under format control. Functions to Search or Compare Character Arrays Function findstr strcmp strcmpi strmatch strncmp strncmpi strtok Description Find one string within another. Compare strings. Compare strings, ignoring case. Find matches for a string. Compare the first N characters of strings. Compare the first N characters, ignoring case. Find a token in a string. Functions to Determine Data Type or Content Function iscellstr ischar isletter Description Return true for a cell array of strings. Return true for a character array. Return true for letters of the alphabet. 2-65

Characters and Strings<br />

Functions to Modify Character Arrays (Continued)<br />

Function<br />

strtrim<br />

upper<br />

Description<br />

Remove leading and trailing white space.<br />

Make all letters uppercase.<br />

Functions to Read and Operate on Character Arrays<br />

Function<br />

eval<br />

sscanf<br />

Description<br />

Execute a string with <strong>MATLAB</strong> expression.<br />

Read a string under format control.<br />

Functions to Search or Compare Character Arrays<br />

Function<br />

findstr<br />

strcmp<br />

strcmpi<br />

strmatch<br />

strncmp<br />

strncmpi<br />

strtok<br />

Description<br />

Find one string within another.<br />

Compare strings.<br />

Compare strings, ignoring case.<br />

Find matches for a string.<br />

Compare the first N characters of strings.<br />

Compare the first N characters, ignoring case.<br />

Find a token in a string.<br />

Functions to Determine Data Type or Content<br />

Function<br />

iscellstr<br />

ischar<br />

isletter<br />

Description<br />

Return true for a cell array of strings.<br />

Return true for a character array.<br />

Return true for letters of the alphabet.<br />

2-65

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!