How to show calculations value into uitable on the GUI?

4 vues (au cours des 30 derniers jours)
Avogusti Eng.Dept.
Avogusti Eng.Dept. le 1 Juin 2020
Commenté : Sugar Daddy le 3 Juin 2020
Hello Everyone! I have some problem with syntax GUI. I have some mathematics equation to calculations 22 data input and make it to 11 data output as variable but doesn't work to show on uitable.
Would can somebody help me please. I want to share my syntax :
Thankyou, godbless to all.
function START_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global yt1 u1 u2 u3 u4 u5 u6 u7 u8 u9 u10 u11
global ASP PCD AFF GT T1 GFT ADP AMF GC T5 AFR
global rb ra
rb = [ 6.67 6.68 0.0775 2500 14.9 35.2 11.3 0.670933948 3100 740 14]; %2856 89% 332
ra = [ 7.39 7.53 0.242222222 2800 33.2 62.1 12.9 2.447537181 3200 760 20]; %3127 98% 488
% ambil data dari table
ASPB = str2num(get(handles.edit8,'String'));
ASPA = str2num(get(handles.edit7,'String'));
PCDB = str2num(get(handles.edit9,'String'));
PCDA = str2num(get(handles.edit10,'String'));
AFFB = str2num(get(handles.edit11,'String'));
AFFA = str2num(get(handles.edit12,'String'));
GTB = str2num(get(handles.edit13,'String'));
GTA = str2num(get(handles.edit14,'String'));
T1B = str2num(get(handles.edit15,'String'));
T1A = str2num(get(handles.edit16,'String'));
GFTB = str2num(get(handles.edit17,'String'));
GFTA = str2num(get(handles.edit18,'String'));
ADPB = str2num(get(handles.edit19,'String'));
ADPA = str2num(get(handles.edit20,'String'));
AMFB = str2num(get(handles.edit21,'String'));
AMFA = str2num(get(handles.edit22,'String'));
GCB = str2num(get(handles.edit23,'String'));
GCA = str2num(get(handles.edit24,'String'));
T5B = str2num(get(handles.edit25,'String'));
T5A = str2num(get(handles.edit26,'String'));
AFRB = str2num(get(handles.edit27,'String'));
AFRA = str2num(get(handles.edit28,'String'));
% equations calculations
ASP =(6.67*1.1-(7.39*(1.1)*(1*1)/2)+7.39*(1.1));
set(handles.uitable5,'Data',ASP);
PCD =(6.68*1.2-(7.53*(1.2)*(1*1)/2)+7.53*(1.1));
set(handles.uitable5,'Data',PCD);
AFF =(0.0775*1.3-(0.242222222*(1.3)*(1*1)/2)+0.242222222*(1.1));
set(handles.uitable5,'Data',PCD);
if GT < 2500 | GT > 2600 % Generator Total KW = 2500 - 2600 KW
GT = 0
else
GT = GT;
end
set(handles.uitable5,'Data',AFF);
T1 =(14.9*1.1-(33.2*(1.1)*(1*1)/2)+33.2*(1.1));
set(handles.uitable5,'Data',T1);
GFT =(35.2*1.1-(62.1*(1.1)*(1*1)/2)+62.1*(1.1));
set(handles.uitable5,'Data',GFT);
ADP =(11.3*1.1-(12.9*(1.1)*(1*1)/2)+12.9*(1.1));
set(handles.uitable5,'Data',ADP);
AMF =(0.67093333948*1.1-(2.447537181*(1.1)*(1*1)/2)+2.447537181*(1.1));
if GC < 3100 | GC > 3200 % Generator capacity = 3100 - 3200 KW
GC = 0
else
GC = GC;
end
set(handles.uitable5,'Data',AMF);
if T5 < 740 | T5 > 760 % Temperature average = 740 - 760 C
T5 = 0
else
T5 = T5;
end
set(handles.uitable5,'Data',T5);
if AFR < 14 | AFR > 20 % AFR 14-20
AFR = 0
else
AFR = AFR;
end
set(handles.uitable5,'String',ASP, PCD, AFF, GT, T1, GFT, ADP, AMF, GC, T5, AFR);
%yt=str2num(get(handles.uitable5,'String'));
%yt=((rb(1.1)-ra(1.1))*(1*(1.1)+1/2)+ra(1.1));
% menghitung nilai konstrain max dan min
set(handles.uitable5,'data',[]);
% value = get(handles.uitable5,'data');
ASP = str2num(get(handles.ASP,'String'));
PCD = str2num(get(handles.PCD,'String'));
AFF = str2num(get(handles.AFF,'String'));
GT = str2num(get(handles.GT,'String'));
T1 = str2num(get(handles.T1,'String'));
GFT = str2num(get(handles.GFT,'String'));
ADP = str2num(get(handles.ADP,'String'));
AMF = str2num(get(handles.AMF,'String'));
GC = str2num(get(handles.GC,'String'));
T5 = str2num(get(handles.T5,'String'));
AFR = str2num(get(handles.AFR,'String'));
%value =
%Data = ([ASP,value, PCD,value, AFF,value, GT,value, T1,value, GFT,value, ADP,value, AMF,value, GC,value, T5,value, AFR,value]);
data = [ASP(:) PCD(:) AFF(:) GT(:) T1(:) GFT(:) ADP(:) AMF(:) GC(:) T5(:) AFR(:)];
set(handles.uitable,'Data',data);
% ASP = tableData(:,1);
.

Réponses (1)

Sugar Daddy
Sugar Daddy le 1 Juin 2020
Ok it is also very strange for me that
set(handles.uitable,'Data',data)
is not setting the uitable data while
this
handles.uitable.Data = data;
is working perfectly
  2 commentaires
Avogusti Eng.Dept.
Avogusti Eng.Dept. le 1 Juin 2020
Thanks bro, it's works!!. But I have some problem again with that uitable. The values just display in 1 cell. Because I need to display values data on 11 cell in a row. May you can help me again?
Thank you..
Sugar Daddy
Sugar Daddy le 3 Juin 2020
Run this mlapp and check the button callback

Connectez-vous pour commenter.

Catégories

En savoir plus sur Dialog Boxes dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by