Hi N,
I understand you pass the image obtained in the 'SelectImageButtonPushed' function to the 'RUNButtonPushed' function in App Designer.
To acheive this you will need to setup a new property in a user defined properties block.Please refer to https://in.mathworks.com/matlabcentral/answers/1829948-passing-objects-from-app-designer-to-the-workspace#comment_2749059 to create a basic property.
Assuming you have a made a property named 'image' , you can refer to the implementation below:
function SelectImageButtonPushed(app, event)
% Open a file dialog to select an image file
[file, path] = uigetfile({'*.jpg;*.png;*.bmp', 'Image Files (*.jpg, *.png, *.bmp)'}, 'Select Image File');
% Read the selected image
image = imread(fullfile(path, file));
% Store the image in the app object as a property
app.image = image;
end
% Run Button Callback
function RUNButtonPushed(app, event)
% Check if an image is selected
if isempty(app.image)
% Display an error message if no image is selected
errordlg('No image selected.', 'Error', 'modal');
return;
end
% Perform operations on the selected image
% Access the image using app.image
% Example:
processedImage = imresize(app.image, 0.5);
% Display the processed image or perform any other desired operations
imshow(processedImage, 'Parent', app.UIAxes);
end
Hope this helps.