attribute to an array of symbolic variables an array with their values

조회 수: 1 (최근 30일)
HI all
Is there a trick to do this in MATLAB ?
[R1 R2 R3 VA VB VG]=[8 2 4 12 -6 0]
I want to assign to all sym variables the values on right

채택된 답변

Walter Roberson
Walter Roberson 2016년 3월 21일
V = num2cell([8 2 4 12 -6 0]);
[R1 R2 R3 VA VB VG] = deal(V{:});
This does not have anything to do with the symbolic toolbox ? Or are you wanting to subs() like that? If so then
subs(TheExpression, [R1 R2 R3 VA VB VG], [8 2 4 12 -6 0])
  댓글 수: 2
timo
timo 2016년 3월 22일
V = num2cell([8 2 4 12 -6 0]);
[R1 R2 R3 VA VB VG] = deal(V{:});
Worked, but the code is ugly :(
Walter Roberson
Walter Roberson 2016년 3월 22일

Yes, unfortunately cell expansion cannot be done on an expression

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by