imwrite を使用してデータをファイルに書き込もうとするとエラーが発生するのはなぜですか?
15 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
MathWorks Support Team
il 8 Ago 2024
Risposto: MathWorks Support Team
il 8 Ago 2024
imwrite 関数を使用してデータをファイルに書き込もうとしています。その際、その時点で存在しないフォルダー内のファイルへのパスを作成し、保存しようとしています:
Z = peaks; surf(Z)
axis tight
set(gca,'nextplot','replacechildren');
surf(sin(2*pi/20)*Z,Z);
F = getframe;
imwrite(F.cdata,'newFolder/testfile.jpeg','jpg')
実行すると次のエラーが発生します:
次を使用中のエラー:ファイル "newFolder/testfile.jpeg" を開いて書き込むことができません。書き込み権限がない可能性があります。
Risposta accettata
MathWorks Support Team
il 8 Ago 2024
imwrite では存在しないフォルダ内のファイルへの書き込みはできません。事前にディレクトリを作成するには mkdir コマンドを使用します。
mkdir('newFolder')
imwrite(F.cdata,'newFolder/testfile.jpeg','jpg')
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su イメージ in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!