when I call the image why does not appear?

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 commentaire

Rik
Rik le 13 Juin 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).

Connectez-vous pour commenter.

Réponses (1)

Image Analyst
Image Analyst le 13 Juin 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 commentaire

Image Analyst
Image Analyst le 13 Juin 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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Programming dans Centre d'aide et File Exchange

Question posée :

nio
le 13 Juin 2023

Commenté :

le 13 Juin 2023

Community Treasure Hunt

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

Start Hunting!

Translated by