MATLAB 帮助中心
确定输入是否为字符向量元胞数组
tf = iscellstr(A)
如果 A 为字符向量元胞数组(或空元胞数组),则 tf = iscellstr(A) 返回逻辑值 1 (true),否则返回逻辑值 0 (false)。字符向量元胞数组是一种每个元胞都包含一个字符向量的元胞数组。
A
1
true
0
false
示例
全部折叠
创建一些不同的数组,然后确定它们是否为字符向量元胞数组。
测试字符向量元胞数组。
C1 = {'Smith','Chung','Morales'; ... 'Sanchez','Peterson','Adams'}
C1 = 2×3 cell {'Smith' } {'Chung' } {'Morales'} {'Sanchez'} {'Peterson'} {'Adams' }
tf = iscellstr(C1)
tf = logical 1
C1 的每个元胞都包含一个字符向量,因此 iscellstr 返回 1。
C1
iscellstr
将 C1 转换为字符串数组并进行测试。
str = string(C1)
str = 2×3 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'} {[0.8147 0.9058 0.1270]}
tf = iscellstr(C2)
C2 具有一个不包含字符向量的元胞,因此 iscellstr 返回 0。
C2
输入数组,指定为标量、向量、矩阵或多维数组。A 可以是任何数据类型。
全部展开
backgroundPool
ThreadPool
此函数完全支持基于线程的环境。有关详细信息,请参阅在基于线程的环境中运行 MATLAB 函数。
此函数完全支持分布式数组。有关详细信息,请参阅使用分布式数组运行 MATLAB 函数 (Parallel Computing Toolbox)。
在 R2006a 之前推出
cellstr | char | iscell | isstrprop | isstring | ischar | string
cellstr
char
iscell
isstrprop
isstring
ischar
string
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处