why file did not appear

2 ビュー (過去 30 日間)
farina
farina 2024 年 5 月 24 日
コメント済み: DGM 2024 年 5 月 24 日

回答 (2 件)

DGM
DGM 2024 年 5 月 24 日
Maybe it has something to do with that big red error because you created an invalid file name.
  2 件のコメント
Steven Lord
Steven Lord 2024 年 5 月 24 日
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 2024 年 5 月 24 日
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.

サインインしてコメントする。


Pratyush Swain
Pratyush Swain 2024 年 5 月 24 日
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.

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by