文档帮助中心
本页对应的英文页面已更新,但尚未翻译。 若要查看最新内容,请点击此处访问英文页面。
确定输入是否为字符向量元胞数组
tf = iscellstr(A)
示例
如果 A 为字符向量元胞数组(或空元胞数组),则 tf = iscellstr(A) 返回逻辑值 1 (true),否则返回逻辑值 0 (false)。字符向量元胞数组是一种每个元胞都包含一个字符向量的元胞数组。
A
1
true
0
false
全部折叠
创建一些不同的数组,然后确定它们是否为字符向量元胞数组。
测试字符向量元胞数组。
C1 = {'Smith','Chung','Morales'; ... 'Sanchez','Peterson','Adams'}
C1 = 2x3 cell {'Smith' } {'Chung' } {'Morales'} {'Sanchez'} {'Peterson'} {'Adams' }
tf = iscellstr(C1)
tf = logical 1
C1 的每个元胞都包含一个字符向量,因此 iscellstr 返回 1。
C1
iscellstr
将 C1 转换为字符串数组并进行测试。
str = string(C1)
str = 2x3 string "Smith" "Chung" "Morales" "Sanchez" "Peterson" "Adams"
tf = iscellstr(str)
tf = logical 0
str 是字符串数组,而非元胞数组,因此 iscellstr 返回 0。
str
测试包含不同数据类型的元素的元胞数组。
X = rand(1,3); C2 = {'red','blue',X}
C2=1×3 cell array {'red'} {'blue'} {1x3 double}
tf = iscellstr(C2)
C2 具有一个不包含字符向量的元胞,因此 iscellstr 返回 0。
C2
输入数组,指定为标量、向量、矩阵或多维数组。A 可以是任何数据类型。
此函数完全支持分布式数组。有关详细信息,请参阅Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox)。
cellstr | char | is* | isa | iscategorical | iscell | ischar | isstring | isstrprop | isstruct | istable | string
cellstr
char
is*
isa
iscategorical
iscell
ischar
isstring
isstrprop
isstruct
istable
string
您的系统上存在此示例的修改版本。是否要打开此版本?
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office