How to call an existing function 3 three times by creating an another function?
조회 수: 3 (최근 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.
댓글 수: 0
답변 (1개)
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!