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
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!!!

请先登录,再进行评论。

采纳的回答

Elias Gule
Elias Gule 2015-3-24
Please see the attached files.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by