フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Run a function m times and store in matrix

1 回表示 (過去 30 日間)
Nina Haugaard
Nina Haugaard 2016 年 8 月 19 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I would like to run a function m times.
The output variables of the function has the dimension of (T+1)x2 and (T/91+1)x2, and I would like to run the function m times, and then store it in two matrices by the form (T+1)x2xm and (T/91+1)x2xm.
But somehow it is not working
Cashflow_dep=zeros(T+1,2,m);
Cashflow_CF=zeros(((T/91)+1),2,m);
for i=1:m;
[Cashflow_dep(:,:,i),Cashflow_CF(:,:,i)]=jumpdifussion(T, sigma_d, sigma_cf, ro, lambda, my_jump, sig_jump, recovery_rate);
end

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 8 月 19 日
Look at this example
n=10
for k=1:n
a{k}=your_function(u1,u2)
end
out=cell2mat(a)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by