help to resolve my this GUI code

조회 수: 1 (최근 30일)
Poonam
Poonam 2015년 3월 16일
답변: Sk Sahariyaz Zaman 2016년 4월 28일
btnNumber=11;
labelPos=[left+3*controlWidth+0.06 top-2*controlHeight controlWidth+0.08 controlHeight-0.005];
callbackStr='mainGUI(''Enhancement '');';
hdl.btn_enhance=uicontrol('Parent',figHandle,...
'Style','pushbutton',...
'Units','normalized',...
'Position',labelPos,...
'Horiz','left',...
'String','Enhancement',...
'FontSize',8,...
'backgroundcolor',figBackColor,...
'Callback',callbackStr,...
'Interruptible','off');
This is the pushbutton function of enhancement of my Gui
enhImgPosition=[imgWidth+50+50-50,figPosition(4)-imgHeight-50,imgWidth,imgHeight];
enhImage=enhanceImage(orgImage);
set(hdl.figHandle_Axes3,'xlim',[.5, imgWidth+.5],'ylim',[.5 imgHeight+.5],'position',enhImgPosition);
set(get(hdl.figHandle_Axes1, 'Title'), 'String', 'Initial segmentation','visible','on');
set(hdl.enhImage, 'XData',[1 imgWidth],'YData',[1 imgHeight],'CData',enhImage);drawnow;
This code for displaying enhancement result on Gui
function Enhancement()
global orgImage;
global enhImage;
global filename0;
global enhResultFilename;
global bwenhancementtResultImage;
enhImage=enhanceImage(orgImage);
cd('.\segmentation results\');
enhResultFilename=[filename0(1:end-4),'_enhancementResult','.bmp'];
[filename filepath]=uiputfile(segResultFilename,'Save enhancement result');
if filename(1) && ~isempty(bwenhancementtResultImage)
imwrite(enhImage,[filepath,filename]);
end
cd('..');
the enhanceImage(orgImage) is my m-file which I have create
But when clicking on the pushbutton I am getting followin error
??? Reference to non-existent field 'enhImage'.
Error in ==> mainGUI>LoadNewAVIFile at 326 set(hdl.enhImage, 'XData',[1 imgWidth],'YData',[1 imgHeight],'CData',enhImage);drawnow;
Error in ==> mainGUI>InitializeMSRMFig at 250 LoadNewAVIFile(figHandle);
Error in ==> mainGUI at 6 feval(action,varargin{:}); % call function
??? Invalid function name 'Enhancement '.
Error in ==> mainGUI at 6 feval(action,varargin{:}); % call function
??? Error while evaluating uicontrol Callback
>> why am i getting this error

답변 (1개)

Sk Sahariyaz Zaman
Sk Sahariyaz Zaman 2016년 4월 28일
In deceleration also you need to write as "global enhImage;" then write - enhImage = enhanceImage(orgImage);
Hope this will solve your problem.

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by