matlab strcmp相反,strcmp strcmpi 比较字符串 matlab

本文详细介绍了字符串比较函数strcmp和strcmpi的用法,包括大小写敏感和不敏感的比较。strcmp用于比较两个字符串是否相等,返回逻辑值表示相等或不等;strcmpi则在比较时忽略字母大小写。这两个函数可以用于单个字符串与细胞数组字符串之间的比较,并返回相应逻辑数组。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

strcmp

Compare strings (case sensitive)

Syntax

TF = strcmp(string,string)

TF = strcmp(string,cellstr)

TF = strcmp(cellstr,cellstr)

Description

TF = strcmp(string,string) compares two strings for equality. The strings are considered to be equal if the size and content of each are the same. The function returns a scalar logical 1 for equality, or scalar logical 0 for inequality.

TF = strcmp(string,cellstr) compares a string with each element of a cell array of strings. The function returns a logical array the same size as the cellstr input in which logical 1 represents equality. The order of the input arguments is not important.

TF = strcmp(cellstr,cellstr) compares each element of one cell array of strings with the same element of the other. The function returns a logical array the same size as either cell array input.

strcmpi Compare strings (case insensitive) Syntax TF = strcmpi(string,string) TF = strcmpi(string,cellstr) TF = strcmpi(cellstr,cellstr) Description TF = strcmpi(string,string) compares two strings for equality, ignoring any differences in letter case. The strings are considered to be equal if the size and content of each are the same. The function returns a scalar logical 1 for equality, or scalar logical 0 for inequality. TF = strcmpi(string,cellstr) compares a string with each element of a cell array of strings, ignoring letter case. The function returns a logical array the same size as the cellstr input in which logical 1 represents equality. The order of the input arguments is not important. TF = strcmpi(cellstr,cellstr) compares each element of one cell array of strings with the same element of the other, ignoring letter case. The function returns a logical array the same size as the input arrays.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值