How a program can call to itself without using function.
显示 更早的评论
I have to execute a program which is calling itself if an particular condition satisfies, without making that program as function.
1 个评论
Geoff Hayes
2014-10-12
Could you add some context/details as to why a program would need to call itself, and why you want to do this without making the program a function.
采纳的回答
更多回答(1 个)
Image Analyst
2014-10-12
It is possible to have a script call itself. For example have this in test3.m:
clc;
d = dbstack;
timesCalled = length(d)
if timesCalled > 495
return; % Prevent max recursion error.
end
fprintf('Current time = %s\nType control-C to exit\n', datestr(now));
test3
Though I'm not sure how advisable this is.
类别
在 帮助中心 和 File Exchange 中查找有关 Function Creation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!