save the value in side the function file

조회 수: 3 (최근 30일)
Laura
Laura 2015년 7월 23일
댓글: Laura 2015년 7월 24일
I have 3 m-files let say:
function [f]=fun(g)
Myy=20*x^2; % Assume we know x matrix
f=Myy;
the 2nd file is
function [c]=bisect(fun,a,b)
Ma=fun(a);
Mb=fun(b)
c=(a+b)/2;
Third file:
a= 1; b=2;
c=bisect(@fun,a,b)
If I run the third file, how do I save (store) value of f every time, a,b is changed. Thanks

답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2015년 7월 23일
k=0;
a= 1;
b=2;
k=k+1
c{k}=bisect(@fun,a,b)
  댓글 수: 1
Laura
Laura 2015년 7월 24일
I tried that but it seems to be not working.

댓글을 달려면 로그인하십시오.


Azzi Abdelmalek
Azzi Abdelmalek 2015년 7월 23일
k=0;
a= 1;
b=2;
k=k+1
c{k}=bisect(@fun,a,b)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by