Clear Filters
Clear Filters

why file did not appear

5 views (last 30 days)
farina
farina on 24 May 2024
Commented: DGM on 24 May 2024

Answers (2)

DGM
DGM on 24 May 2024
Maybe it has something to do with that big red error because you created an invalid file name.
  2 Comments
Steven Lord
Steven Lord on 24 May 2024
That was the first thing I noticed too. MATLAB program files cannot have spaces in their names. Rename it to something like image1.m or image_1.m and try running it again.
Looking at the Files list, the next problem you're likely to encounter is that there's probably no "image 1.jpg" file in a location accessible to MATLAB. Find it and put it in your MATLAB Drive files or in a directory on the MATLAB Search Path (like the directory whose name is returned by the userpath function.)
DGM
DGM on 24 May 2024
Strangely enough, I went ahead and tried this and it seems that a person could get blindsided or confused by this sort of thing depending on how they use the editor.
I always use ctrl-enter to run scripts in cell mode. In that manner, no error is produced.
If you use F5 run or the ribbon, you will get an error. In R2024a in MATLAB online, I get an error about the filename being invalid. In R2019b, I get the following error:
Error using image
Color data must be numeric or logical values.
... which happens because of the split filename now being interpreted as an existing function. You're just two characters away from a different type of naming problem.

Sign in to comment.


Pratyush Swain
Pratyush Swain on 24 May 2024
Hi farina,
As your image file is not visible in the "Files" Directory, I would first suggest to make sure your image file - 'image 1.jpg' is uploaded to this directory in MATLAB Drive. To access your MATLAB Drive, you can visit https://drive.mathworks.com/ or access it from the matrix menu at https://matlab.mathworks.com/.
You can also follow the workarounds mentioned in this MATLAB Answers thread as follows: https://www.mathworks.com/matlabcentral/answers/409750-imshow-not-working
Hope this helps.

Categories

Find more on Search Path 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!