timer オブジェクトを含むスタンドアロンアプリケーションが期待通りの動作をしないのはなぜですか?
Show older comments
timer オブジェクトを含む .m ファイルを MATLAB Compiler でスタンドアロンアプリケーション化しました。実行させてみると、指定回数の実行前に終了してしまうなど、期待通りの動作となりません。
testTimer.m:
-------------------------
function testTimer
i = 1;
t = timer('TimerFcn', @time_cbf, 'Period', 1, 'ExecutionMode', 'fixedRate', 'TasksToExecute', 10);
start(t);
function time_cbf(obj, event)
t = obj;
disp(i);
i = i + 1;
if i>10
stop(obj);
end
end
end
-------------------------
MATLAB 環境上での実行例:
-------------------------
>> testTimer
1
2
3
4
5
6
7
8
9
10
-------------------------
コマンドプロンプトでの実行例(1回のみ実行される):
-------------------------
>testTimer
1
-------------------------
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB Compiler in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!