How to use uitable?

Hi everyone,
I am trying to add data to existing uitable but it's not working... i am new with the matlab gui.
can anyone please help me?
this is my code
function uitable2_CreateFcn(hObject, eventdata, handles) % hObject handle to uitable2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
CNR1_threshold=getappdata(0,'CNR1');
CNR2_threshold=getappdata(0,'CNR2');
SNR_threshold=getappdata(0,'SNR');
DR1_threshold=getappdata(0,'DR1');
DR2_threshold=getappdata(0,'DR2');
DR3_threshold=getappdata(0,'DR3');
UNI1_threshold=getappdata(0,'UNI1');
UNI2_threshold=getappdata(0,'UNI2');
UNI3_threshold=getappdata(0,'UNI3');
UNI4_threshold=getappdata(0,'UNI4');
ThresholdsBasicVal=[CNR1_threshold CNR2_threshold SNR_threshold ... DR1_threshold DR2_threshold DR3_threshold ... UNI1_threshold UNI2_threshold UNI3_threshold UNI4_threshold]
CNR1_1 = getappdata(0,'CNR1_1'); CNR2_1 = getappdata(0,'CNR2_1'); SNR_1 = getappdata(0,'SNR_1'); DR1_1 = getappdata(0,'DR1_1'); DR2_1 = getappdata(0,'DR2_1'); DR3_1 = getappdata(0,'DR3_1'); U1_1 = getappdata(0,'U1_1'); U2_1 = getappdata(0,'U2_1'); U3_1 = getappdata(0,'U3_1'); U4_1 = getappdata(0,'U4_1');
Image1Val=[CNR1_1 CNR2_1 SNR_1 DR1_1 DR2_1 DR3_1 ... U1_1 U2_1 U3_1 U4_1];
data1Results=CheckImageValues(Image1Val,length(Image1Val),ThresholdsBasicVal);
if (isempty(getappdata(0,'STD2'))==0)
CNR1_2 = getappdata(0,'CNR1_2');
CNR2_2 = getappdata(0,'CNR2_2');
SNR_2 = getappdata(0,'SNR_2');
DR1_2 = getappdata(0,'DR1_2');
DR2_2 = getappdata(0,'DR2_2');
DR3_2 = getappdata(0,'DR3_2');
U1_2 = getappdata(0,'U1_2');
U2_2 = getappdata(0,'U2_2');
U3_2 = getappdata(0,'U3_2');
U4_2 = getappdata(0,'U4_2');
Image2Val=[CNR1_2 CNR2_2 SNR_2 DR1_2 DR2_2 DR3_2 ...
U1_2 U2_2 U3_2 U4_2];
data2Results=CheckImageValues(Image2Val,length(Image2Val),ThresholdsBasicVal);
else
data2Result = ['NoImgVal' 'NoImgVal' 'NoImgVal' 'NoImgVal' ...
'NoImgVal' 'NoImgVal' 'NoImgVal' 'NoImgVal' 'NoImgVal' 'NoImgVal'];
end
if (isempty(getappdata(0,'STD3'))==0)
CNR1_3 = getappdata(0,'CNR1_3');
CNR2_3 = getappdata(0,'CNR2_3');
SNR_3 = getappdata(0,'SNR_3');
DR1_3 = getappdata(0,'DR1_3');
DR2_3 = getappdata(0,'DR2_3');
DR3_3 = getappdata(0,'DR3_3');
U1_3 = getappdata(0,'U1_3');
U2_3 = getappdata(0,'U2_3');
U3_3 = getappdata(0,'U3_3');
U4_3 = getappdata(0,'U4_3');
Image3Val=[CNR1_3 CNR2_3 SNR_3 DR1_3 DR2_3 DR3_3 ...
U1_3 U2_3 U3_3 U4_3];
data3Results=CheckImageValues(Image3Val,length(Image3Val),ThresholdsBasicVal);
else
data3Result = ['NoImgVal' 'NoImgVal' 'NoImgVal' 'NoImgVal' ...
'NoImgVal' 'NoImgVal' 'NoImgVal' 'NoImgVal' 'NoImgVal' 'NoImgVal'];
end
if (isempty(getappdata(0,'STD4'))==0)
CNR1_4 = getappdata(0,'CNR1_4');
CNR2_4 = getappdata(0,'CNR2_4');
SNR_4 = getappdata(0,'SNR_4');
DR1_4 = getappdata(0,'DR1_4');
DR2_4 = getappdata(0,'DR2_4');
DR3_4 = getappdata(0,'DR3_4');
U1_4 = getappdata(0,'U1_4');
U2_4 = getappdata(0,'U2_4');
U3_4 = getappdata(0,'U3_4');
U4_4 = getappdata(0,'U4_4');
Image4Val=[CNR1_4 CNR2_4 SNR_4 DR1_4 DR2_4 DR3_4 ...
U1_4 U2_4 U3_4 U4_4];
data4Results=CheckImageValues(Image4Val,length(Image4Val),ThresholdsBasicVal);
else
data4Result = {'NoImgVal' 'NoImgVal' 'NoImgVal' 'NoImgVal' ...
'NoImgVal' 'NoImgVal' 'NoImgVal' 'NoImgVal' 'NoImgVal' 'NoImgVal'};
end
ImgBasicResults={data1Results,data2Results,data3Results,data4Results};
colnames={'IMAGE1','IMAGE2','IMAGE3','IMAGE4'};
set(hObject,'Data',ImgBasicResults,'Colnames',colnames);

답변 (1개)

Image Analyst
Image Analyst 2013년 4월 9일

0 개 추천

Don't put anything into the CreateFcn(). Put it other places, like in a button callback or the OpeningFcn, or wherever you want to execute it. Try that.

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

태그

질문:

2013년 4월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by