Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

how to increase the function numbers

Asked by Arun Badigannavar on 5 Feb 2013

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 Comment

Azzi Abdelmalek

Azzi Abdelmalek (view profile)

on 5 Feb 2013

If you have just one function, what is your goal in changing the name of this function?


No products are associated with this question.

1 Answer

Answer by Jan Simon

Jan Simon (view profile)

on 5 Feb 2013

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


Jan Simon

Jan Simon (view profile)

Contact us