Where can I insert my Operation and How to display the result in Static Text?
조회 수: 1 (최근 30일)
이전 댓글 표시
I was trying to insert this operation: F=a1+a2+a3+a4+a5+a6+a7+a8+a9;(BUT IM GETTING THIS ERROR Undefined function or variable 'a1'. Error in Determinants>pushbutton1_Callback (line 335) F=a1+a2+a3+a4+a5+a6+a7+a8+a9;)
and display the determinants of F by using this det(F); in static text but I don't know how.
댓글 수: 1
Elias Gule
2015년 3월 24일
In your pushbutton1_Callback: define a matrix 3 x 3 matrix.
M = zeros(3,3);
count = 0;
for k = 1 : 3
for l = 1 : 3
count = count + 1;
key = ['a' num2str(count)];
val = str2double(get(handles.(key),'String'));
M(l,k) = val;
end
end
set(handles.results,'String',num2str(det(M)));
where a1:a9 are represents tags for each text component assigned in a columnwise manner. GUIDE stores references to each component in the handles structure; this enables easy communication between the components. The hObject in the object's callback represents the current object; that is the object to which the callback is assigned.
So if you ever use guide for your GUIs, then the handles structure is your friend!!!
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!