⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_nested_2.m

📁 matlab programming for engineers(2nd)书籍源码,这是一本很好的学习MATLAB编程书
💻 M
字号:
function res = test_nested_1

% This is the top level function.
% Define some variables.
a = 1;
b = 2;
x = 0;
y = 9;

% Display variables before call to fun1
disp('Before call to fun1:')
disp(['a = ' num2str(a)]);
disp(['b = ' num2str(b)]);
disp(['x = ' num2str(x)]);
disp(['y = ' num2str(y)]);

% Call fun1
x = fun1(x);

% Display variables after call to fun1
disp(' ');
disp('After call to fun1:')
disp(['a = ' num2str(a)]);
disp(['b = ' num2str(b)]);
disp(['x = ' num2str(x)]);
disp(['y = ' num2str(y)]);

   % Declare a nested function 
   function res = fun1(y)
   res = y + a;
   a = a + 1;
   
   % Display variables inside call to fun1
   disp(' ');
   disp('Inside call to fun1:')
   disp(['a = ' num2str(a)]);
   disp(['b = ' num2str(b)]);
   disp(['x = ' num2str(x)]);
   disp(['y = ' num2str(y)]);

   end % function fun1

end % function test_nested_1


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -