switch between subfunctions

Hi hi,
i have a main function that includes many other sub functions inside. I want to switch between subfunction,i.e. block some of them and run the others. Any idea how to make it?
function main ()
.
function1 ()
function2 () . .
end
Tnx,
Azarm

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2011년 8월 24일

0 개 추천

use switch or if..end, e.g.:
function funmain(..., p1)
function funs1()
...
end
function funs2()
...
end
... % 1 or 2 variant
end
% 1 variant
switch p1
case case_expr1
... = funs1();
case case_expr2
... = funs2();
end
% 2 variant
if p1 == expr (or strcmp(p1,expr)...)
... = funs1();
else
... = funs1();
end

댓글 수: 1

azarm
azarm 2011년 8월 24일
tnx, didn'n notice that it works for functions too:)

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기

질문:

2011년 8월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by