c*****y 发帖数: 80 | 1 如何定义一个变量a,在程序主体main.m中辅值使用,在
辅助函数程序func.m中也能使用?
例如:
main.m
...
...
for a=0:1
func();
end...
func.m
function [p]=func(t,x)
p=a^2*t*x | o*****e 发帖数: 435 | 2 please:
help global;
==================================
function tic
% TIC Start a stopwatch timer.
% TIC; any stuff; TOC
% prints the time required.
% See also: TOC, CLOCK.
global TICTOC
TICTOC = clock;
function t = toc
% TOC Read the stopwatch timer.
% TOC prints the elapsed time since TIC was used.
% t = TOC; saves elapsed time in t, does not print.
% See also: TIC, ETIME.
global TICTOC
if nargout < 1
elapsed_time = etime(clock,TICTOC)
else
t = etime(clock,
【在 c*****y 的大作中提到】 : 如何定义一个变量a,在程序主体main.m中辅值使用,在 : 辅助函数程序func.m中也能使用? : 例如: : main.m : ... : ... : for a=0:1 : func(); : end... : func.m
|
|