如果我有两个功能:
//function 1
function [tp] = Calculate_T_P();
//body of function 1
// here I define U, which is a random integer between 0 and 15
U = randi([15])
// say U is generated to be e.g., 5
现在我想在 for 循环中使用我的第二个函数的第一个函数中生成的 U 的相同值(即 5):
//function 2
function [sp] = Calculate_S_P();
//Body of function 2
for b=0:U
// body of for loop
end
谁能告诉我如何实现这一目标?谢谢!