필터 지우기
필터 지우기

Force timeout for save()?

조회 수: 3 (최근 30일)
Matthias
Matthias 2014년 2월 3일
답변: Sean de Wolski 2014년 3월 10일
Hi,
I'm using save() to save a workspace variable on a network share. Sometimes, the share is temporarily unavailable. How can I instruct save to give up trying to save the file after a specified timeout?
Thanks!
  댓글 수: 4
Walter Roberson
Walter Roberson 2014년 2월 12일
Avoid doing the save() to a share. save() locally. copyfile() afterwards.
Is there a way at the Windows command level to tell if the share is available?
Matthias
Matthias 2014년 3월 10일
What is the advantage of copyfile() over save() with respect to gracefull handling disk access problems?

댓글을 달려면 로그인하십시오.

답변 (1개)

Sean de Wolski
Sean de Wolski 2014년 3월 10일
Try to open a file on the drive first, if you can't open it, then the drive is unavailable. Overall, Walter's approach is better and more stable, though and I would recommend following it.
fid = fopen(fullfile(thedrectory,'Arandomfile.txt'),'w');
if fid == -1
error('Couldn''t open')
end

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by