Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Undefined function 'leadlag' for input arguments of type 'double'.

Subject: Undefined function 'leadlag' for input arguments of type 'double'.

From: Ryan

Date: 23 Sep, 2012 17:46:08

Message: 1 of 1

I am trying some sample code from here:
http://www.mathworks.com/matlabcentral/fileexchange/37932-automated-trading-with-matlab-2012/content/html/Demo2_MA_Rule.html

I modified the code just a bit:
annualScaling = sqrt(250);
leadlag(Close,1,20,annualScaling)

I made the proper adjustments, and I can’t tell why I’m getting this error:
Undefined function 'leadlag' for input arguments of type 'double'.

I guess Matlab is converting the doubles to ints, because your array contains a single int. This has to do with a precision issue. So, I would think that you could Cast it, or force it to be Double, but it still doesn’t work:
annualScaling = sqrt(250);
double(annualScaling);
leadlag(Close,1,20,annualScaling)
Undefined function 'leadlag' for input arguments of type 'double'.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us