How to call an existing function 3 three times by creating an another function?

3 views (last 30 days)
I already have a function which make a GUI.
I want to call this function by creating an another function . I want to call that three times. Do I need a for loop for that? If yes then how do I do it?
How to do that?
function gui_changed_color(task_no,fault_no_list,fault_no)
this is the function I already have.

Answers (1)

Navya Singam
Navya Singam on 12 Jul 2021
Edited: Navya Singam on 12 Jul 2021
Hi Praneethi,
function function_name()
for i = 1:3 % using a for loop to call the function
gui_changed_color(task_no, fault_no_list, fault_no) % here task_no, fault_no_list,fault_no are the parameters to be passed to gui_changed_color
end
end
Here gui_changed_color function is called 3 times using the for loop in the function_name. When the function_name function is called, it calls gui_changed_color function with specified parameters for 3 times , it calls gui_changed_color function with specified parameters for 3 times as i value increments by 1 each time and reaches till 3.
Refer to this documentation function for more information on function and for loop for more information on for loop.
Hope this helps.

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!