b=importda​ta(input('​Enter path of image '))

1 visualización (últimos 30 días)
Mangesh
Mangesh el 10 de Ag. de 2014
Comentada: Image Analyst el 10 de Ag. de 2014
Sir, i have to call path of image from my drive and import this image by importdata and save as variable b.......please help me!

Respuestas (1)

Geoff Hayes
Geoff Hayes el 10 de Ag. de 2014
Mangesh - rather than using the input function, consider uigetfile instead. It is easier to get the user to choose the file using a GUI rather than trying to type in the path and name. For example, your above code could be rewritten as
% choose a file and define the extensions (more can be added in a similar fashion)
[filename, pathname] = uigetfile({'*.jpg;*.bmp;*.gif'},'Image File Chooser');
% if the cancel button is pressed, then filename is numeric (0)
if ischar(filename)
% we have a file name, so create the full path and file name string
pathToFile = fullfile(pathname, filename);
b = importdata(pathToFile);
end
Try the above and see what happens!
  1 comentario
Image Analyst
Image Analyst el 10 de Ag. de 2014
If it's really an image, use imread() instead of importdata().

Iniciar sesión para comentar.

Categorías

Más información sobre Images en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by