File Exchange

image thumbnail

Measures of Analysis of Time Series toolkit (MATS)

version (3.41 MB) by Dimitris Kugiumtzis
MATS computes many measures of scalar time series analysis on many time series in one go.


Updated 02 May 2012

View License

The Measures of Analysis of Time Series (MATS) toolkit computes a number of different measures of analysis of scalar time series (linear, nonlinear and other statistical measures). It also contains pre-processing tools (transformations and standardizations), data splitting facility, resampled data generation, and visualization facilities for the time series and the computed measures. The strength of the MATS toolkit is the simultaneous operation on both multiple time series and multiple measures, allowing a range of measure specific parameters to be set as well. Help for any action is provided in html.
A main feature of MATS is that it keeps track of two lists: the time series list containing the set of scalar time series to be analyzed, and the measure list containing the values of the selected measures computed on the time series in the current time series list. The time series list is dynamic so that time series can be deleted from the list and new time series can be added to the list by selecting specific data-related operations, i.e. loading time series files, standardizing or segmenting time series from the list, or generating resampled (surrogate) time series (left part of the main menu window). A number of various measures of different types (linear, nonlinear, others) can be selected. The selected measures are then computed on all the time series in the current time series list and the measure values are stored in the current measure list, where for each measure and for each combination of its parameter values a unique name is assigned (right part of the main menu window). The computed measures can be viewed in different ways by selecting measure names from the measure list and time series names from the time series list associated to the computed measures, e.g. plots of measures versus segment or surrogate time series index, or measures versus one or two varying parameters (2D and 3D plot). The visualization facility for the measure vs surrogate time series index contains also parametric and nonparametric tests.
The user can select many different measures, as well as measure specific parameters, compute them on different time series, and view the results on the different measures and time series. It should be noted that the computation for each selected measure can be slow when a large number of time series are selected or the length of the time series is large (or both). Also, some measures, such as the measure of the local linear model and the measure of the correlation dimension, require long computation time.

Cite As

Dimitris Kugiumtzis (2020). Measures of Analysis of Time Series toolkit (MATS) (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (37)

Hei Antonio,
It is not an error for the purpose we had in mind, i.e. treat (analyze) each column of the output matrix 'yM' as a seperate time series. If you want to analyze the time series in the different columns of 'yM' jointly and alligned in time, then indeed you should define 'yM' as you propose. We found more convenient to fill up all first components of 'yM'.

Is there an error in the indexing of the function LagDifference(xV,lagV)??

the output lagged transformation is

yM(1:n-lagV(ilag),ilag) = xV(lagV(ilag)+1:n)-xV(1:n-lagV(ilag));

While I think should be

yM(lagV(ilag)+1:n,ilag) = xV(lagV(ilag)+1:n)-xV(1:n-lagV(ilag));

Mirko Kück

Hi Dimitris,
thank you for your quick answer. I am not sure for which purposes the kdtree functions are used exactly. If it is only for nearest neighbor search, how about using the functions knnsearch and rangesearch contained in the Statistics and Machine Learning Toolbox?

Hei Mirko,
As mentioned in the description of the MATS toolkit the kdtree functions are used for data structure and nerest neighbor search. This is a rather old product we adopted and it seems that it does not run properly with newer versions of Matlab. We now use a different product for nearest neighbor search that is stable to newer Matlab versions and different platforms, but unfortunately we have not substituted this in MATS. It takes time that I do not have, now. Meanwhile, if you (or any user of MATS) finds a solution for the use of kdtree, please inform me and I will try to apply it in MATS.

Mirko Kück

Hi Dimitris,
in order to fix yesterday's problem, I tried to mex the kdtree functions. However, I received a similar error to those of BenoitD:

>> mex
Building with 'MinGW64 Compiler (C++)'.
Error using mex
U:\MATS\ In function 'void mexFunction(int, mxArray**, int, const mxArray**)':
U:\MATS\ warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
if ( (tree = (Tree *) ((long) pointer_to_tree[0]))== NULL )
U:\MATS\ error: cast from 'Tree* {aka tree*}' to 'long int' loses precision [-fpermissive]
pointer_to_tree[0] = (long) tree;

Do you have an idea to solve this problem? Thank you and best regards,

Mirko Kück

Hi Dimitris,

I am trying to find the false nearest neighbors of a time series. I am running Matllab version 2017b, Windows 10, 64bit. If I type in the following:

>> y=1:100;
>> FalseNearestNeighbors(y,1:10,1:10,10,0)

I receive the following error:

Attempt to execute SCRIPT kdtreeidx as a function:
Error in FalseNearestNeighbors (line 83)

Could you please help me with this issue?

Best regards,

Hei Stephen,
This problem is not due to a bug in MATS or a function of it that you are using. It seems that it has to do with the new Matlab version you are using.


I'm running the CorrelationDimension(xV,tauV,mV,theiler,sV,resol) function from a Java program using the MATLAB engine for Java and I keep getting this error:

Error using \
Linear algebra is not supported for integer data types. Use LDIVIDE (.\) for elementwise left division.

Error in nuT (line 163)
x = A \ b;

com.mathworks.engine.MatlabExecutionException: nuT
at com.mathworks.engine.FutureResult.get(
at com.mathworks.engine.MatlabEngine.feval(
at InfoFlow.correlationDimension(
at InfoFlow.calculateCorrelationDimensions(
at InfoFlow.draw(
at processing.core.PApplet.handleDraw(
at processing.awt.PSurfaceAWT$12.callDraw(
at processing.core.PSurfaceNone$
Caused by: com.mathworks.mvm.exec.MvmRuntimeException: Linear algebra is not supported for integer data types. Use LDIVIDE (.\) for elementwise left division.

Although the elements of A and b appear to be doubles, I have tried casting them as doubles 1) by using the double function, and 2) by multiplying them by 1.0. Neither worked.


Trying to mex the kd tree files gives me errors on win10 64 matlabR2017:

Error using mex
C:\matlabSandbox\kdtree\src\ In function 'void
mexFunction(int, mxArray**, int, const mxArray**)':
C:\matlabSandbox\kdtree\src\ warning: cast to
pointer from integer of different size [-Wint-to-pointer-cast]
if ( (tree = (Tree *) ((long) pointer_to_tree[0]))== NULL
C:\matlabSandbox\kdtree\src\ error: cast from
'Tree* {aka tree*}' to 'long int' loses precision
pointer_to_tree[0] = (long) tree;

And many more...


Hi Mark,
It seems that the problem lies in the path you are using. Try to use a short and simple path, e.g. D:\

Oreia doulia megale! sigxaritiria.

Hi Dimitris,
Thanks for the work that you've done on creating MATS. I've been able to run some of the Measures successfully (e.g. Linear and NonLinear correlation) but the Complexity measures keep outputting errors that I can't figure out. For example, running ApproxEntr gives the error below. Have you seen this before? Something that I'm doing wrong perhaps?

I'm running Matlab R2012a 7.14. Any help would be appreciated. Thanks!

Attempt to execute SCRIPT kdtreeidx as a function:

Error in ApproximateEntropy (line 82)

Error in guiselectmeasures>pushbutton11_Callback (line 2002)
apenT = ApproximateEntropy(xV,par1V,par2V,par3V,par4V);

Error in gui_mainfcn (line 96)

Error in guiselectmeasures (line 75)
gui_mainfcn(gui_State, varargin{:});

Error in

Error using waitfor
Error while evaluating uicontrol Callback


Mac version of compiled kdtree.m is needed


I am trying to run the GUI to generate surrogate data right now but after I load the data and click Resampled time series, the Resampling Types box doesn’t populate and only shows greyed out boxes for Degree of polynomial approximation, Order of autoregressive model and Order of autoregressive model (repeated). The only box that is not grayed out and available is Number of resampled time series. My colleague also just started running the GUI with the exact same data file and we found that the Resampling Types box populated with all the methods that were available (i.e. FT, AAFT etc.). We are using the exact same Matlab version, data files and followed the same steps so I have no idea how to get it to populate. Do you know what might be causing this error?

Hi Maximos,
My immediate reply is that for the k-d-tree data structure and nearest neighbors search we turned now to the faster routines of ann. We have not yet implemented them in MATS, but we will soon come with a new version incorporating this. Thanks for the link anyway. Unfortunately, we do not use MAC therefore we have not compiled the C-programs for MACOSX. We will try to find a MAC machine and do it (no promise this will be done immediately).

Concerning my previous post about the source code of the kdtree functions:

I found these files on an other submission

where one can find the C source files and compile them for hers/his system. To compile, however, one minor modification of the .h file is required, as stated in a comment on the aforementioned page.

All the best,

This contribution encompasses more than I would ever need for time series analysis.

There is however some kind of incompatibility with the operating system I use, MACOSX. Specifically the mex files are not compiled for the architecture of my system's processor (extensions should be .mexmaci64).

Would it be possible to provide the C source files, so that the users could compile them themselves for their systems' architectures? If not, would it be possible to provide mex files for more processor architectures (like for example, MACI64)?

Thank you in advance,

Hi Tolga,
MATS does not contain a function "gettype.m". I also do not know CeeGraph, so I cannot help you in this.

Hi Thomas,
1. You are correct. If a user loads a file with more one dot, it is treated as a plain text file containing a data matrix. We could not have made the assumption you mention (get the suffix after the last dot). Our experience and practice is to use just one dot, therefore we did not bother to check different possibilities with multiple dots. Maybe this will be done in a future version.
2. I now realized that we changed the function guiread.m but not uploaded it. In the updated function this issue was treated. I will make sure it is updated now.

Hi, I noticed that the function "gettype.m" can get the header information for CeeGraph EEG data (.EEG BLSC format) - however I couldn't achıeve to read the data afterwards. I'd be grateful if you could suggest me a way from MATS toolbox to do so (which parameters? and which m file?). Thanks.


Hi Dimitris!

All the following concerns the function function pushbutton1_Callback(hObject, eventdata, handles) of the file guiread.m

Add 1.) Your using this line:
ii = find(fileC{i,1}=='.');
to get the index(es) of dots in the filename, and then this line:
suffixS = fileC{i,1}(ii+1:end);
to get the suffix. If a filename contains more than one dot, as far as I know convention is to take the last dot for splitting between filename and extension (since none of the commonly known extensions contain dots) This codeline however takes the first dot for splitting. Therefore this will not correctly detect edf and xls files and just use the matlab load function for everything - this line:

Add 2.) You use this line:
to save the files content in your variables for further processing. This will only work if A) there are multiple variables in the .mat file which will be loaded by matlab into a cell array of the filename, or if B) if there is only a single variable and it has the same name as the filename minus the extension.

Hi Thomas,

For 1), I see no problem with dots in the data filename. However, I admit that we have not concentrated on the form of the path and filename. We found the bug that MATS cannot read a path having spaces.

For 2), when selecting a .mat file, MATS lists all the columns of the one or two dimensional matrix variables in the mat-file. If the mat-file contains variables of other types, these will be ignored. See also text message under the field "Running messages" in the window "Load Time Series".


You're help file on loading files (MATS/helpfiles/LoadTimeSeries.htm) should state the following restrictions:

1.) The filename of the file loaded is only allowed to contain exactly one "." between the name and the extension

2.) If one loads a .mat file, the variable name one wants to use from this mat file needs to be exactly the same name as the file (without the ".mat" extension).

Hi Mohamed Aboamer,
Please read the web-supported help document for the measure you want to use. There is more explanation there than in the help text at the head of the Matlab function.

Dear ---,
I'm tried to calculate Correlation Dimension but i didn't know the values of:


where, time series "xV" length is 5537 point "one column array"

Hi Matthew,
Thank you for your comment. The effort was not directed on making the code user-friendly, but rather the GUI itself. MATS is based on a compilation of codes developed over a rather long period for personal use. The idea was to deliver a product for end-use without requiring any interference with matlab codes. As for the requirement of moving to the MATS directory before launching MATS, certainly this can be improved, but we did not consider it as a burden for the user.


This a an extensive GUI for the analysis of time series measures. Thanks for your contribution to the FEX.

However, I did not find the code... how should I put this... user friendly. For example, the frequent (and unneeded) use of eval statements; and that the user is required to run the GUI from *a particular directory* for certain links to work correctly.

Min Gan


Hi, j gor,
There is no predefined range of expected values for bicorrelation (other than the interval [-1,1]) and cumulative bicorrelation. You can still contrast your value to expected values (i.e. distribution of the measure) under some null hypothesis, e.g. independent and identical distributed data (iid). To do this, you can compare the value of the measures computed on your time series with the values you get from appropriate surrogate data (see the facility for resampling). Note however that bicorrelation has much larger variance than, say, Pearson autocorrelation.

henry gorx

Hi, I tested the function Bicorrelation(xV,tauV,flag), how I must to interpret the results? for example, bicV=-0.18738 and cumbicV=0.70683. Many thanks for your help.

Dear Yubaraj,

You probably run an older matlab version than 7.1. You should first run the matlab function "changeallfig", so that "new" gui-functions can be run by "old" matlab versions. The following text with instructions about this action is taken from the README file of the MATS packet.

MATS runs as is with matlab version 7.1 or later. For those who have an older matlab version, they should first run the function "changeallfig" giving as input variable the full path of the MATS directory. This function updates all files of .fig type in order to be run by older matlab versions.



I get the following error when i tried running the measures

Error in ==> gui_mainfcn>local_openfig at 216
gui_hFigure = openfig(name, singleton, 'auto');

Error in ==> gui_mainfcn at 94
gui_hFigure = local_openfig(gui_State.gui_Name, gui_SingletonOpt);

Error in ==> guiselectmeasures at 75
gui_mainfcn(gui_State, varargin{:});

Error in ==> MATS>pushbutton6_Callback at 222

Error in ==> gui_mainfcn at 75

Error in ==> MATS at 75
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback.


An update of the text of Description has been made, stressing specifically the components of MATS and including the reference, where the toolkit is presented.

MATLAB Release Compatibility
Created with R2008a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: k-D tree