MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1
fullName =

'Thomas R. Lee, Sr. Developer, SFTware Corp.'


  • Call the concatenation function, strcat. This method removes trailing spaces in the
    inputs. For example, combine character vectors to create a hypothetical email address.


name = 'myname ';
domain = 'mydomain ';
ext = 'com ';

address = strcat(name, '@', domain, '.', ext)

MATLAB returns

address =

'[email protected]'

Identify Characters


Use any of the following functions to identify a character array, or certain characters in a
character array.


Function Description
ischar Determine whether the input is a character array
isletter Find all alphabetic letters in the input character array
isspace Find all space characters in the input character array
isstrprop Find all characters of a specific category

Find the spaces in a character vector.


chr = 'Find the space characters in this character vector';
% | | | | | | |
% 5 9 15 26 29 34 44


find(isspace(chr))


ans =


5 9 15 26 29 34 44


Create Character Arrays
Free download pdf