Calling a function within another function?

조회 수: 1 (최근 30일)
Jackie
Jackie 2014년 9월 29일
답변: David Sanchez 2014년 9월 29일
I'm pretty new to matlab so this may be a stupid question.
How would I call another function in a nother function? In this case, I'm writing a tic-tac-toe function for homework and I've already written "randommove" and "requestmove" and I want to write a third function called tictactoe that utilizes the both of them. I feel like it's going to be really tedious to type out the code for each every single time, though?

답변 (1개)

David Sanchez
David Sanchez 2014년 9월 29일
Just call them from within tictactoe:
In your tictactoe function:
function your_outputs = tictactoe(your_inputs)
...
your code_here
...
% and make the call whenever you need it
fun_out = randommove(funtion_inputs);
fun_out2 = requestmove(fun_in);
...

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by