Main Content

fts2ascii

Write elements of time series data into ASCII file

fts2ascii is not recommended. Use timetable instead. For more information, see Convert Financial Time Series Objects fints to Timetables.

Description

example

stat = fts2ascii(filename,tsobj,exttext) writes the financial time series object tsobj into an ASCII file filename. The data in the file is tab delimited.

example

stat = fts2ascii(filename,dates, data,colheads,desc) writes into an ASCII file filename the dates, times, and data contained in the column vector dates and the column-oriented matrix data. The first column in filename contains the dates, followed by times (if specified). Subsequent columns contain the data. The data in the file is tab delimited.

Examples

collapse all

Create a data file with time information.

dates = ['01-Jan-2001';'01-Jan-2001'; '02-Jan-2001'; ... 
'02-Jan-2001'; '03-Jan-2001';'03-Jan-2001'];
times = ['11:00';'12:00';'11:00';'12:00';'11:00';'12:00'];
serial_dates_times = [datenum(dates), datenum(times)];
data = round(10*rand(6,2));

Use fts2ascii to write the time series to an ascii file.

stat = fts2ascii('myfts_file2.txt',serial_dates_times,data, ... 
{'dates';'times';'Data1';'Data2'},'My FTS with Time')
Warning: FINTS is not recommended. Use TIMETABLE instead. For more information, see <a href="matlab:web(fullfile(docroot, 'finance/convert-from-fints-to-timetables.html'))">Convert Financial Time Series Objects (fints) to Timetables</a>.
stat = 1

Read the data file back and create a financial time series object using ascii2fts.

MyFts = ascii2fts('myfts_file2.txt','t',1,2,1)
Warning: FINTS is not recommended. Use TIMETABLE instead. For more information, see <a href="matlab:web(fullfile(docroot, 'finance/convert-from-fints-to-timetables.html'))">Convert Financial Time Series Objects (fints) to Timetables</a>.
 
MyFts = 
 
    desc:  My FTS with Time
    freq:  Unknown (0)

    {'dates:  (6)'}    {'times:  (6)'}    {'Data1:  (6)'}    {'Data2:  (6)'}
    {'01-Jan-2001'}    {'11:00'      }    {[          8]}    {[          3]}
    {'     "     '}    {'12:00'      }    {[          9]}    {[          5]}
    {'02-Jan-2001'}    {'11:00'      }    {[          1]}    {[         10]}
    {'     "     '}    {'12:00'      }    {[          9]}    {[         10]}
    {'03-Jan-2001'}    {'11:00'      }    {[          6]}    {[          2]}
    {'     "     '}    {'12:00'      }    {[          1]}    {[         10]}

Input Arguments

collapse all

Name of ascii file, specified as a character vector.

Data Types: char

Financial time series object, specified as a fints object.

Data Types: object

(Optional) Extra text written after the description line, specified as a character vector.

Data Types: char

Dates, specified as a column vector containing dates. Dates must be in serial date number format and can specify time of day.

Data Types: double

Data, specified as column-oriented matrix. Each column is a series.

Data Types: double

(Optional) Column headers, specified as a cell array of character vectors for column headers (names); the first cell must always be the one for the dates column. colheads is written to the file just before the data.

Data Types: cell

(Optional) Description text (which is the first line in the file), specified as a character vector.

Data Types: char

Output Arguments

collapse all

Status of file creation, returned as a logical where successful is 1 or not successful is 0.

Version History

Introduced before R2006a