help to resolve my this GUI code

3 views (last 30 days)
Poonam
Poonam on 16 Mar 2015
Answered: Sk Sahariyaz Zaman on 28 Apr 2016
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

Answers (1)

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

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!