이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
How can I show symbolic object in uitable?
syms i2,i3 'real';
a=[ 0 0 -i3; 1 2 3];
a(2,2)=-i2;
set(handles.uitable2, 'Data',a);
채택된 답변
Walter Roberson
2011년 11월 2일
1 개 추천
You cannot show symbolic objects in a uitable. In uitable, you can only show numbers and text. You can find the text representation of a symbolic object by using char() on the object. But remember, that will return text, not a symbolic object, so you will not be able to use the text as a symbolic object.
댓글 수: 6
john
2011년 11월 2일
Thank You,
So:
1. How can I convert symbolic object ( or in my case system of equations) to char type, for uitable? Or how can I find text representation of a symbolic object?
I used command a(i,j)=findsym(UserData.maticaA{i,j});
but I got this mistake: Undefined function or method 'findsym' for input arguments of type 'char'.
Here is result of real task created with M-file:
s =
(Vo + Io*R3*alfa)/(R1 + R2)
(Vo + Io*R3*alfa)/(R1 + R2)
-(Vo + Io*R3*alfa)/(R1 + R2)
-Io
-Io
Io - (Vo + Io*R3*alfa)/(R1 + R2)
(R1*(Vo + Io*R3*alfa))/(R1 + R2)
-Io*R3*alfa
-(R2*(Vo + Io*R3*alfa))/(R1 + R2)
-Io*R3
Vo + Io*R3
Vo
(R1*(Vo + Io*R3*alfa))/(R1 + R2)
(R1*Vo - Io*R2*R3*alfa)/(R1 + R2)
Vo
Vo + Io*R3
So I have to show this in GUI.
2. Exist other way, how can I show result without uitable?
Walter Roberson
2011년 11월 2일
You can find the text representation of a symbolic object by using char() on the object.
Example:
syms x y
f = x^2 + 3*x*y + 2;
char(f)
To convert text to a symbolic object, use sym()
For example
f = sym('x^2 + 3*x*y + 2');
Once you have it in symbolic form, you can extract the names of the variables that occur in the expression using symvar(). For example
symvar(f)
would return the symbolic names x and y . Depending on context, you may want to char() the result.
Warning: "symvar does not consider the constants pi, i, and j to be variables."
Walter Roberson
2011년 11월 2일
Can you show the result without a uitable? Sure. You could text() it in to place, or you could create a uicontrol('Style','text'), or a uicontrol('Style','edit')
john
2011년 11월 2일
for this case
syms i2,i3 'real';
a=[ 0 0 -i3; 1 2 3];
a(2,2)=-i2;
how can I show matrix a in uicontrol('Style','text')
Walter Roberson
2011년 11월 2일
uicontrol('Style','text', 'String', cellstr(char(a)) )
(You will want to add a Position parameter in to that of course.)
If you use instead use 'Style', 'edit', be sure to set 'Max' to at least 2. Another hint is if you want non-editable text but you want it to be vertically scrollable, then instead of using 'Style', 'text', use 'Style', 'edit', 'Max', 2, 'Enable', 'disable'
john
2011년 11월 3일
Big Thank You Mr. Walter Roberson,
cellstr(char(a)) is the best command ever :-).
Thank You so much again
Now my program works great, I put in uitable "symbolic object", and than I show "symbolic object" in other uitable
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
