I have an image. In app designer , I use "axes application" to add image there. When I click first button I add image and show it in Axes area.
I added second button . In second button I want to filter that same image when I click it.
For example my image name is "imgf" and I use imshow(img) when I click first button and show it. I want to use that "imgf" in my second button. But it gives error.
Because that "imgf" belongs to in first button function codes. How will I use that "imgf" in my second button function codes.
Codes are below
    methods (Access = private)
        
        function SelectAnImageButtonPushed(app, event)
            global imgf;
            [filename pathname]= uigetfile({'*.jpg'},"Open file");
            fullpathname= strcat(pathname,filename);
            
            imgf=imread(fullpathname);
            if(size(imgf,3)>1)
            imgf=rgb2gray(imgf);
            end
           
            imshow(imgf,'parent',app.UIAxes);
            
        end
        
        function FilterTheImageButtonPushed(app, event)
            
            img=imgaussfilt(imgf);  
            imshow(img,'parent',app.UIAxes);
        end
    end