Comparing cell arrays of symbolic variables
2 ビュー (過去 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!