why file did not appear

2 Ansichten (letzte 30 Tage)
farina
farina am 24 Mai 2024
Kommentiert: DGM am 24 Mai 2024

Antworten (2)

DGM
DGM am 24 Mai 2024
Maybe it has something to do with that big red error because you created an invalid file name.
  2 Kommentare
Steven Lord
Steven Lord am 24 Mai 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 am 24 Mai 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.

Melden Sie sich an, um zu kommentieren.


Pratyush Swain
Pratyush Swain am 24 Mai 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.

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by