How to open .mat files and simply explore the content in it?
19 views (last 30 days)
Show older comments
Harsha Priya G
on 7 Oct 2020
Commented: Harsha Priya G
on 11 Oct 2020
How to open the following .mat file and explore it in matlab editor.
I tried to load it using 'load' command and used 'imshow' but it is not working.
4 Comments
Stephen23
on 7 Oct 2020
Edited: Stephen23
on 7 Oct 2020
" I tried the following code: storedStructure = load('SUN_urls.mat'); figure(1);imshow(1);"
The .mat file contains one structure array of size 1x900 with three fields:
- category : an alphabetical list of objects
- annotation : URLs to some XML files
- images : URLs to some JPG files
The .mat file does not contain any image data. To get the images you will need to download them from those URLS.
Accepted Answer
Ameer Hamza
on 7 Oct 2020
Edited: Ameer Hamza
on 7 Oct 2020
Your mat file contains a struct array. Which does not contain the images itself, but the url of images. You need to use imread() to load those images and then use imshow(). Here is an example
data = load('SUN_urls.mat');
SUN = data.SUN;
url = SUN(1).images{1};
img = imread(url);
imshow(img);

3 Comments
Ameer Hamza
on 9 Oct 2020
You can write a loop and go through all the URLs to download them. I am not sure how the pre-computed features and annotations are available.
More Answers (0)
See Also
Categories
Find more on Large Files and Big Data 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!