필터 지우기
필터 지우기

how can call a result used inside a function?

조회 수: 1 (최근 30일)
arkedia
arkedia 2014년 8월 6일
편집: dpb 2014년 8월 6일
i'v created the following loop
for i=1:k
samples=simss(e,y,q,m,cfg);
z=[z;samples];
end
the function simss works as follows: 1- using [b_LS, sigma_b_LS, s_LS] = lscov(x,y) function to calculate regresssion of x matrix on y 2- use s_LS result in the rest of simss function the problem is :s_LS result dose not appear in the previous code and i need it to be used after the loop (for) ends as follows
for i=1:k
samples=simss(e,y,q,m,cfg);
z=[z;samples];
end
aic=n*log s_LS+2q
HOW CAN I CALL s_LS

답변 (1개)

dpb
dpb 2014년 8월 6일
편집: dpb 2014년 8월 6일
Only by adding s_LS as an additional output to your function simss can you pass it back up to the calling function's workspace (ignoring abominations such as GLOBAL, etc., anyway)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by