when I call the image why does not appear?
Show older comments
a=uigetfile();
filename=a;
setappdata(0,'filename',filename);
a=imread(a);
axes(handles.axes1);
imshow(a);
setappdata(0,'a',a);
setappdata(0,'filename',a);
plot(handles.axes1,'a');
1 Comment
Rik
on 13 Jun 2023
Why exactly are you using this code? Why do you expect plot to display an image?
If you have trouble with Matlab basics you may consider doing the Onramp tutorial (which is provided for free by Mathworks).
Answers (1)
Image Analyst
on 13 Jun 2023
You don't need to do anything with appdata. Simply do this:
% Have user browse for a file, from a specified "starting folder."
% For convenience in browsing, set a starting folder from which to browse.
startingFolder = pwd; % or 'C:\wherever';
if ~isfolder(startingFolder)
% If that folder doesn't exist, just start in the current folder.
startingFolder = pwd;
end
% Get the name of the file that the user wants to use.
defaultFileName = fullfile(startingFolder, '*.*');
[baseFileName, folder] = uigetfile(defaultFileName, 'Select a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName)
% Read image into an array.
rgbImage = imread(fullFileName);
% Display the image.
imshow(rgbImage, []);
1 Comment
Image Analyst
on 13 Jun 2023
It's a generic, general purpose demo of how to threshold an image to find blobs, and then measure things about the blobs, and extract certain blobs based on their areas or diameters.
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!