On 10/12/10 9:03 PM, Laurentiu Galan wrote:
> I am currently running the function [Sharpe, Win%, Loss%, CumRet] =
> pairtrade(lcap,scap,lentry,sentry,k,f)
> I want to change this function to:
> [Sharpe, Win%, Loss%, CumRet] = pairtrade(lcap,scap,lentry,sentry,k,f, PEP)
> so that when i run this function the very next line is:
> fid=fopen('V:\Desktop\PEP.csv')
> This is already saved in 'V:\Desktop\PEP.csv
> However, I want this as a variable so that if I do:
> [Sharpe, Win%, Loss%, CumRet] = pairtrade(lcap,scap,lentry,sentry,k,f, KO)
> the very next line will be
> fid=fopen('V:\Desktop\KO.csv')
> Basically I want the ending to the V:\Desktop\KO.csv to be a variable.
That isn't going to work, because PEP and KO are not defined variables.
A variable has to have a definition in order to appear in an argument
list for a function call.
What would work is if instead the parameter was 'PEP' and 'KO' each in
quotes.
fid = fopen(sprintf('V:\\Desktop\\%s.csv', FileNameVariable));
> Also, how do I take take the mean and standard deviation of a matrix A
> in pieces without loops. i.e. if I want the mean of a n x 1 matrix only
> for the values 55 to the end? Same with standard deviation. Can I do:
> mean(A(55:end,1)) and std(A(55:end,1))
Yes, just like that.
