imwrite function and permission error

조회 수: 107 (최근 30일)
bkshn
bkshn 2014년 9월 11일
답변: aditya chiliveri 2016년 6월 23일
I read any question and answer about my problem, but I couldn't find my solution. I checked read only about my folder. I use mkdir , but I can't do it. Could you help me more. Thanks alot
K>> imwrite(a1,'C:\Users\Bahar\Documents\Uni\Thesis\IMP\930620','jpg');
Error using imwrite (line 455) Unable to open file "C:\Users\Bahar\Documents\Uni\Thesis\IMP\930620" for writing. You may not have write permission.

채택된 답변

Geoff Hayes
Geoff Hayes 2014년 9월 11일
bkshn - I get the same error message if trying to do something similar. But look closer at the error message
Unable to open file "C:\Users\Bahar\Documents\Uni\Thesis\IMP\930620"
No extension is being supplied to the file that is being opened. Try including the extension in the file name (it isn't enough to just supply the output format of jpg) as
imwrite(a1,'C:\Users\Bahar\Documents\Uni\Thesis\IMP\930620.jpg','jpg');
The above worked (for me) when I included the extension.

추가 답변 (1개)

aditya chiliveri
aditya chiliveri 2016년 6월 23일
I had the same issue of write permission.
Try checking if the file which you want to write already exists in the folder by below script
if exist('folder\filename.jpg', 'file')
delete('folder\filename.jpg')
end
Then try saving again by imwrite

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by