i'm trying to do an assignment for my class and the undo button click should reload the previous transformation applied onto the image in case i wish to go back. The golabal variable is defined in the start of the code
function LoadimgBtn_Callback(hObject, eventdata, handles)
% hObject handle to LoadimgBtn (see GCBO)
[filename,pathname]=uigetfile('C:\Users\hassan\Desktop\DIP PROJECT IMGS\MonoChrome
Images\*.jpg;*.png;*.jpeg');
file_path=strcat(pathname,filename);
og_img=imread(file_path);
axes(handles.org_img);
imshow(og_img);
prev_img=og_img;
axes(handles.intr_img);
imshow(prev_img);
As observed the global variable prev_img is utlized perfectly here however when i try to use the same variable in my undo code there is an error thrown that the variable does not exist.
function UndoBtn_Callback(hObject, eventdata, handles)
axes(handles.intr_img);
imshow(prev_img);
I wish to utilize the same variable through the global variable method.