Where can I insert my Operation and How to display the result in Static Text?

1 view (last 30 days)
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 Comment
Elias Gule
Elias Gule on 24 Mar 2015
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!!!

Sign in to comment.

Accepted Answer

Elias Gule
Elias Gule on 24 Mar 2015
Please see the attached files.

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!