how to increase the function numbers

조회 수: 4 (최근 30일)
Arun Badigannavar
Arun Badigannavar 2013년 2월 5일
I have function called "editwin",,,now i want to increase the functions dynamically like"editwin1","editwin2","editwin3","editwin4","editwin5","editwin6",,only names should change dynamically
  댓글 수: 1
Azzi Abdelmalek
Azzi Abdelmalek 2013년 2월 5일
If you have just one function, what is your goal in changing the name of this function?

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

답변 (1개)

Jan
Jan 2013년 2월 5일
No, please do not do this. Inserting an index in a name is always a bad idea.
Please explain what you actually want to achieve. Perhaps this helps, but usually the are better solutions:
for counter = 1:6
fcn = str2func(sprintf('editwin%d', counter))
feval(fcn) % for example
end

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by