how does imread know where to look on my computer to find the graphics file?

15 views (last 30 days)
how does imread know where to look on my computer to find the graphics file? It says file does not exist but it does and is save in a documents folder. In java or html we need to explicitly give the path file to find and read in a file. I have not seen anything that says this for matlab. However matlab can not find my file?? How do I let matlab know where to look?

Answers (1)

Ameer Hamza
Ameer Hamza on 15 May 2020
Edited: Ameer Hamza on 15 May 2020
You can specify the complete path of file with imread()
img = imread('C:\....\imageFile.jpg');
If you don't specify the complete path, then imread() search for the file on MATLAB's path: https://www.mathworks.com/help/matlab/ref/path.html
You can add and remove any folder from MATLAB's path: https://www.mathworks.com/help/matlab/ref/pathtool.html

Categories

Find more on File Operations in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!