Comparing cell arrays of symbolic variables
1 次查看(过去 30 天)
显示 更早的评论
I'd like to be able to compare two arrays, each consisting of symbolic variables. In particular I'd like to be able to run setdiff on them. But setdiff appears not to work for symbolic arrays, as the example illustrates
syms a b c
G{1} = {a,b,c}
G{2} = {a,b}
setdiff(G{1},G{2})
Is there an alternative way of accomplishing what setdiff should be able to accomplish?
Thanks!
0 个评论
回答(1 个)
Subhadra Mahanti
2016-2-8
编辑:Subhadra Mahanti
2016-2-8
isequal(G{1},G{2})
The above code will return if true and 0 otherwise.
2 个评论
Walter Roberson
2016-2-8
You do not have symbolic arrays to take the set difference of. {a,b,c} is a cell array each element of which contains one symbol. The symbolic array form would be
G{1} = [a, b, c];
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Variables, Expressions, Functions, and Preferences 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!