MATLAB Toolbox errors

Discussion in 'Trading Software' started by sycaten, Nov 18, 2005.

  1. sycaten


    Matlab version 7.1.0 R14 SP3
    Datafeed toolbox version 1.7
    Financial Time Series toolbox version 2.2

    Well, everything seems up to date, just wanted to make sure that is known before i post my problem here.

    Steps i go through.

    a) Datafeed , download data from Yahoo finance, i've used Nasdaq composite, SP500 and DowJones. Saved it in a matlab file named index.mat

    b) Financial time series, trying to load the index.mat to do some analysis on nasdaq composite and i get an error as:

    ??? Attempt to reference field of non-structure array.

    Error in ==> ftseries\private\setftsguidata at 25
    data_desc{didx, 1} = MAT_data{didx}.desc;

    Error in ==> ftsfilemenu at 78
    setftsguidata(MAT_data, data_names, data_class);

    ??? Error while evaluating uimenu Callback.


    Then i try a DIFFERENT METHOD

    c) I download the data directly from yahoo and convert it to, first .xls and then to a ascii .txt file.

    d) Datafeed toolbox, trying to import the ascii data and i get an error as:

    ??? Error using ==> ascii2fts
    Either the file contents do not correspond to the input
    information, or the file contents contain time information
    which was not indicated in the function call.

    The actual error generated when reading the text file via
    TEXTREAD is:

    Number of outputs must match the number of unskipped input fields.

    Error in ==> ftsfilemenu at 691
    MAT_data = ascii2fts([pathname, filename], DescLine, ColHeadLine, SkipLines);

    ??? Error while evaluating uimenu Callback.


    What might be the problem here ? :mad:
  2. “The load Function
    The load function reads binary files containing matrices generated by earlier MATLAB sessions, or reads text files containing numeric data. The text file should be organized as a rectangular table of numbers, separated by blanks, with one row per line, and an equal number of elements in each row. For example, outside of MATLAB, create a text file containing these four lines:

    16.0 3.0 2.0 13.0
    5.0 10.0 11.0 8.0
    9.0 6.0 7.0 12.0
    4.0 15.0 14.0 1.0

    Store the file under the name magik.dat. Then the statement

    load magik.dat

    reads the file and creates a variable, magik, containing our example matrix. An easy way to read data into MATLAB in many text or binary formats is to use Import Wizard.”

    When you click on “Download To Spreadsheet” on yahoo the data is saved as a comma delimited file (*.csv). The load function requires blacks not commas (according to the documentation) so you need to edit the data (replace ',' with ' '). Also yahoo data has a header row, you may want to try deleting that row and see what happens. Maybe you should also review the documentation on the Import Wizard; you should be able to import comma delimited data with a header.
  3. sycaten


    First, thank you for your reply, i noticed that matlab do use matrices with blanks.

    However the data i am trying to use is downloaded with Matlab's own toolbox 'Datafeed' and then saved into a corresponding .mat file. This must be some guarantee that matlab's own toolbox retrieves and stores the data in a format that then can be loaded in the toolbox 'Financial Time Series' without giving errors ?
    All steps a) -> b) are being made from within matlab using only the above toolboxes.

    (correction first post: step d) is financial time series toolbox not datafeed toolbox)
  4. You already have the answer: there is a data layout mismatch. To confirm this create your own test file in the appropriate format and see if it can be read. If so there is no configuration error with MATLAB and it is simply a data format mismatch.
  5. sycaten


    So Matlab creates a data mismatch in toolbox datafeed so that the data can not be loaded in the toolbox financial time series ? That is quite interesting since they are meant to be used together. In defence they (Mathworks) do tend to support more expensive feeds like Bloomberg and Hyperfeed better, at least what i can Google at the moment.

    Ok, i try to manually edit the data created within toolbox datafeed and then load it in toolbox financial time series. (This is of course not a good solution since i want to track more than a thousand equities, indices on a daily basis).

    Thank you