Search code examples
matlabimread

"Unexpected MATLAB operator" error when reading image


I am trying to read an image in Matlab using the following command as I found it in Matlab docs:

A = imread(d:/img,png)

but the problem is Matlab can not read the path and says : Error: Unexpected MATLAB operator.

I also tried using, /, //, \ and \ in the filepath, but none of them worked.

Please let me know how to get it working.


Solution

  • You need to put ' around the filename and the file is probably named 'img.png' (a dot not a comma)

    A = imread('d:/img.png')