help to resolve my this GUI code

1 次查看(过去 30 天)
Poonam
Poonam 2015-3-16
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