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

2 次查看(过去 30 天)
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.

回答(1 个)

Navya Singam
Navya Singam 2021-7-12
编辑:Navya Singam 2021-7-12
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.

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by