フィルターのクリア

symbolic array, zero-based elements into another array

1 回表示 (過去 30 日間)
Artur M. G. Lourenço
Artur M. G. Lourenço 2011 年 11 月 9 日
if I have the following matrix:
syms x11 x21 x31 x41
a = [ 1*x11 2*x21 3*x31 3*x41]
b = [ 1*x11 2*x21 3*x41]
I want to generate a array which is c:
c = [1*x11 2*x21 0 3*x41]
is easy to do this however does not touch time with sym then forgot.
Thanks in advance.

採用された回答

Walter Roberson
Walter Roberson 2011 年 11 月 9 日
I do not understand your line about "does not touch time with sym then forgot".
c = a;
c(a == sum(a) - sum(b)) = 0;
You might perhaps want to describe the variable possibilities in more detail if the above is not the answer.

その他の回答 (2 件)

Andrei Bobrov
Andrei Bobrov 2011 年 11 月 9 日
syms x11 x21 x31 x41
a = [ 1*x11 2*x21 3*x31 3*x41]
b = [ 1*x11 2*x21 3*x41]
c = a.*ismember(a,b)
  1 件のコメント
Artur M. G. Lourenço
Artur M. G. Lourenço 2011 年 11 月 11 日
Your answer is correct.

サインインしてコメントする。


Artur M. G. Lourenço
Artur M. G. Lourenço 2011 年 11 月 11 日
Thank you for all

カテゴリ

Help Center および File ExchangeNumeric Solvers についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by