How to subtract two matrices of character type arrays?

1 回表示 (過去 30 日間)
Shahram Sahraei
Shahram Sahraei 2016 年 11 月 3 日
回答済み: Shahram Sahraei 2016 年 11 月 4 日
Hello Everyone, I have two cells like the following: A{10,1,1}=[a b c d e; a b c d e; a b c d e; a b c d e]; B{2,1,1}=[a b; c d; b d; a e]; A{10,1,1}-B{2,1,1}=[c d e; a b e; a c e; b c d]; How can I subtract cell B from cell A? Can anyone help me in this regard? Thanks in advance.

採用された回答

Hang Qian
Hang Qian 2016 年 11 月 4 日
You may consider row-wise comparison (possibly in a FOR loop)
setxor({'a','b','c','d','e'},{'a','b'})
setxor({'a','b','c','d','e'},{'c','d'})
setxor({'a','b','c','d','e'},{'b','d'})
setxor({'a','b','c','d','e'},{'a','e'})
Best,
Hang Qian

その他の回答 (1 件)

Shahram Sahraei
Shahram Sahraei 2016 年 11 月 4 日
Thanks a lot,Hang. your answer was helpful.
Best Shahram Sahraei

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by