help to resolve my this GUI code

2 vues (au cours des 30 derniers jours)
Poonam
Poonam le 16 Mar 2015
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

Réponses (1)

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

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by