How do I store all results from a Monte Carlo simulation? The output only shows the last entry. Any help would be appreciated - I'm a Matlab newbie and have been stuck on this for a while.
Thanks!
Presumably inside the function or whatever you have a loop something like:
so what you do is something like:Code:function x=SomeFunc(nitert) for idx=1:nitert x=some calculation of an instantation of a random variable X end
then when called the function returns an array if instantations of the RV X.Code:function rv=SomeFunc(nitert) rv=zeros(1,nitert); for idx=1:nitert x=some calculation of an instantation of a random variable X rv(idx)=x; end
RonL