why file did not appear

3 vues (au cours des 30 derniers jours)
farina
farina le 24 Mai 2024
Commenté : DGM le 24 Mai 2024

Réponses (2)

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

Connectez-vous pour commenter.


Pratyush Swain
Pratyush Swain le 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.

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by