error writing in matlab 7.11 ( r2010b)

14 ビュー (過去 30 日間)
danny agus
danny agus 2011 年 5 月 20 日
when i try this code imaqreset clear all
vid = videoinput('winvideo', 1'); % inisialisasi hardware
vid.FramesPerTrigger = 5;
vid.TriggerRepeat = inf;
triggerconfig(vid, 'manual');
vid.TimerFcn = 'trigger(vid)';
vid.TimerPeriod = 0.5;
for ctr = 1:3
Img = getsnapshot(vid);
fname = ['Image' num2str(ctr)];
%mkdir('coding')
imwrite(Img,fname, 'JPG');
end
the error message show in command window
??? Error using ==> imwrite at 453
Can't open file "Image1" for writing.
You may not have write permission.
Error in ==> kamerasukses at 15
imwrite(Img,fname, 'JPG');
but when i use the matlab 7 i can run this program is there any solution ?
i already try to use mkdir to create a directory

回答 (2 件)

Jan
Jan 2011 年 5 月 20 日
What is the current directory when the program runs? Which directory did you try to create using MKDIR and has it been successful?
Please try:
disp(cd)
fileattrib(cd)
% To my surprice "UserWrite: 0" does *not* mean, that
% I cannot create a file in the directory?!
imwrite(rand(100, 100, 3), 'test.jpg', 'jpg');
[Succ, Msg] = mkdir('coding');
if Succ ~= 1, error(Msg); end
imwrite(rand(100, 100, 3), ...
fullfile(cd, 'coding', 'test.jpg'), 'jpg');
  1 件のコメント
danny agus
danny agus 2011 年 6 月 1 日
sorry for the late reply
i have try the code above
but still error
have any solution ?
the error message is
??? Error using ==> imwrite at 453
Can't open file "test.jpg" for writing.
You may not have write permission.
Error in ==> Untitled at 5
imwrite(rand(100, 100, 3), 'test.jpg', 'jpg');

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


Beth
Beth 2011 年 8 月 25 日
Are you using Windows 7 by chance? You may be running into conflict with the Windows 7 Index function. Fairly detailed instructions for turning it off are here.
  2 件のコメント
jinan eng
jinan eng 2012 年 11 月 20 日
i have problem Error using ==> imwrite at 457 Can't open file "onion.png" for writing. You may not have write permission.
Jan
Jan 2012 年 11 月 20 日
Please, jinan eng, open a new thread for a new question. Thanks.

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by