try_repeatedly.m

版本 1.0.0.0 (1.2 KB) 作者: Clark Williams
Create scripts that are resiliant to intermittant errors
126.0 次下载
更新时间 2014/7/18

查看许可证

Tired of having scripts you leave running overnight fail because of intermittent network / filesystem errors? Me too. So I wrote try_repeatedly(). Think of it as a more "determined" version of try. It doesn't give up the first time the code inside throws an error, but attempts to run the code again, after a pause, up to 16 times before giving up.
EXAMPLE
Assuming you had a function in unreliable_processing.m that
takes a single input and has a single output that occassionally
throws an error due to intermittent network issues:

x = 5;
try_repeatedly( 'y = unreliable_processing( x )' );
z = y+1;
save results z

引用格式

Clark Williams (2024). try_repeatedly.m (https://www.mathworks.com/matlabcentral/fileexchange/47270-try_repeatedly-m), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2012b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Scope Variables and Generate Names 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0