'destination' is invalid

52 ビュー (過去 30 日間)
Kamal Premaratne
Kamal Premaratne 2022 年 6 月 25 日
コメント済み: dpb 2022 年 6 月 26 日
I am creating a plot in the following manner:
>> X = [1 2 3 4 5];
>> plot(X', linewidth = 2)
Now, I want to save the plot in a pdf file:
>> exportgraphics(gca, 'Test.pdf')
This is the error that MATLAB spits out:
>> Error using exportgraphics. The value of 'destination' is invalid. Unable to create output file 'EdgeWeightEstimation.pdf', Permission
denied.
I would very much appreciate if anyone could point out what I am doing wrong and how I could corect it. Thank you.
- Kamal
  1 件のコメント
Walter Roberson
Walter Roberson 2022 年 6 月 25 日
Could you confirm that your command requested Test.pdf but that the error message refers to a completely different file name?

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

採用された回答

dpb
dpb 2022 年 6 月 25 日
編集済み: dpb 2022 年 6 月 25 日
This isn't a MATLAB syntax error; it's indicating that your default working directory (the location given by cd at command line prompt) is one for which you do not have write permission. This is set in the OS permissions.
Change your target file name to include a fully-qualified file name including the directory location that is one to which you have write permissions (or change your working location to one instead is probably the more satisfactory solution longer term).
In general, you should have your starting location for MATLAB leave you in a working directory that is yours and writeable and not one of the MATLAB installation folders that are write protected.
Show us what
cd
returns...
  4 件のコメント
Kamal Premaratne
Kamal Premaratne 2022 年 6 月 26 日
Thank you so much for this valuable insight. Try as I might, I couldn't locate this piece of information elsewhere.
-- K
dpb
dpb 2022 年 6 月 26 日
Yeah, while the doc is extensive, it isn't always as intuitive about where the more general stuff is and the lookup tools are built entirely around functions, not subjects.
If you just open the doc for MATLAB, there's a "Getting Started" section and this stuff is under "Environment and Settings" under it...
The link online doc is <matlab/startup-and-shutdown> which is a few levels down, but to TMW's credit does go into excruciating detail. It just takes digging to get there...

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSearch Path についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by