Having trouble displaying an image

I've been trying to display an image of the avatar on matlab and have been using A=imread('avatar.jpg') but it keeps coming up with the error- Undefined function 'getFileFromURL' for input arguments of type 'char'. I was wondering what I can do to fix this problem

5 件のコメント

Meg Noah
Meg Noah 2021 年 4 月 1 日
The file is not in the path.
Image Analyst
Image Analyst 2021 年 4 月 1 日
@Meg Noah, that error would not come from the file not existing. Instead you'd get this:
>> A = imread('avatar.jpg')
Error using imread>get_full_filename (line 570)
File "avatar.jpg" does not exist.
Error in imread (line 377)
fullname = get_full_filename(filename);
@Kendall Donahoe, attach your jpg file with the paperclip icon so we can try it ourselves.
Kendall Donahoe
Kendall Donahoe 2021 年 4 月 1 日
I have attached it here
Kendall Donahoe
Kendall Donahoe 2021 年 4 月 1 日
I attached the file @Image Analyst
Meg Noah
Meg Noah 2021 年 4 月 1 日
This works:
A = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/569324/avatar.jpg');

サインインしてコメントする。

回答 (1 件)

Divya Gaddipati
Divya Gaddipati 2021 年 4 月 6 日

0 投票

You need to specify the entire path to the image's location.
im = imread('/path/to/image/avatar.jpg');
Another option would be copy/move the image to your current location and then read the image.
im = imread('avatar.jpg');

タグ

質問済み:

2021 年 3 月 31 日

回答済み:

2021 年 4 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by