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

1 Ansicht (letzte 30 Tage)
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 Kommentar
Elias Gule
Elias Gule am 24 Mär. 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!!!

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Elias Gule
Elias Gule am 24 Mär. 2015
Please see the attached files.

Weitere Antworten (0)

Kategorien

Mehr zu Environment and Settings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by