필터 지우기
필터 지우기

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)

Artur M. G. Lourenço
Artur M. G. Lourenço 2011년 11월 11일
Thank you for all

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by