如何比较用MATLAB阵列 [英] how to compare array with matlab
本文介绍了如何比较用MATLAB阵列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想昏迷pre字符串的两个数组
我怎么可能会影响下面的值 A
, B
, C
, D
,当我尝试如下,我得到了一个错误
I would like to comapre two arrays of strings
how could I affect the following values to a
,b
,c
,d
, when I try as below, I got an error
[a,b,c,d] = getVal(x);
=>this will gives :
a =
a
b=
0
c =
10
d =
[]
和我有:
expected = {'a','0','10',[]};
我怎么能让之间[A,B,C,D]比较满意?
how could I make the comparison between [a,b,c,d] and expected ?
推荐答案
从立昂的回答继,你可能想要的是像
Following on from Li-aung's answer, what you probably want is something like
isequal({a,b,c,d}, {'a', '0', '10', '20'})
这将返回真正
当且仅当 A
值为'A'
等。
This will return true
iff a
has the value 'a'
and so on.
修改
要进行多次的分配的,你可以使用DEAL
To perform multiple assignments, you can use DEAL
[a,b,c,d] = deal('a', '0', '10', '20')
这篇关于如何比较用MATLAB阵列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文