matlab in ischar determine whether the input array of characters

Source: https:? //Ww2.mathworks.cn/help/matlab/ref/ischar.html searchHighlight = ischar & s_tid = doc_srchtitle

 

grammar

 

Explanation

Examples

If the Acharacter array, then the logical value returned ( ); logical value otherwise ( ).tf = ischar(A)1true0false

 

Examples

Collapse

Determine whether the array is an array of characters

Create a number of different array, and then determine whether they are an array of characters.

A character test vectors.

chr = 'Mary Jones'
chr = 
'Mary Jones'
tf = ischar (CHR)
tf = logical
   1

Test an array of numbers.

X = rand(1,3)
X = 1×3

    0.8147    0.9058    0.1270

tf = ischar(X)
tf = logical
   0

Test string array. R2017a from the start, you can create strings using double quotes.

str = ["Smith","Chung","Morales"; ...
       "Sanchez","Peterson","Adams"]
str = 2x3 string array
    "Smith"      "Chung"       "Morales"
    "Sanchez"    "Peterson"    "Adams"  

tf = ischar(str)
tf = logical
   0

strIs a string array instead of a character array, therefore ischarreturn 0.

 
 

Input parameters

Collapse

A- input array
scalar | vector | matrix | multidimensional arrays

Input array, is designated as a scalar, vector, matrix or multidimensional array. AIt can be any data type.

extensions

C / C ++ code generation
using MATLAB® Coder ™ C code generated C ++ code.

This function fully supports GPU array. For more information, see the Run MATLAB Functions ON A GPU (Parallel Computing Toolbox).

This function fully supports distributed arrays. For more information, see the Run Functions with MATLAB Distributed Arrays (Parallel Computing Toolbox).

Guess you like

Origin www.cnblogs.com/MCSFX/p/11855982.html
Recommended