matlab ascii2fts,[求助]请问使用matlab2008a读取时间序列,出现下述提示,如何解决??...

你的时间文件没有列名吧

以下是matlab里的帮助:

ascii2fts

Create financial time series object from ASCII data file

Syntaxtsobj = ascii2fts(filename, descrow, colheadrow, skiprows) tsobj = ascii2fts(filename, timedata, descrow, colheadrow, skiprows)

Arguments

filenameASCII data file

descrow(Optional) Row number in the data file that contains the description to be used for the description field of the financial time series object

colheadrow(Optional) Row number that has the column headers/names

skiprows(Optional) Scalar or vector of row numbers to be skipped in the data file

timedataSet to 'T' if time-of-day data is present in the ASCII data file or to 'NT' if no time-of-day data is present.

Description

tsobj = ascii2fts(filename, descrow, colheadrow, skiprows)creates a financial time series object tsobj from the ASCII file named filename. This form of the function can only read a data file without time-of-day information and create a financial time series object without time information. If time information is present in the ASCII file, an error message appears.

The general format of the text data file isCan contain header text lines.

Can contain column header information. The column header information must immediately precede the data series columns unless skiprows is specified.

Leftmost column must be the date column.

Dates must be in a valid date string format:'ddmmmyy'or 'ddmmmyyyy'

'mm/dd/yy'or 'mm/dd/yyyy'

'dd-mmm-yy' or 'dd-mmm-yyyy'

'mmm.dd,yy' or 'mmm.dd,yyyy'

Each column must be separated either by spaces or a tab.

tsobj = ascii2fts(filename, timedata, descrow, colheadrow, skiprows)creates a financial time series object containing time-of-day data. Set timedata to 'T' to create a financial time series object containing time-of-day data.

Examples

Example 1. If your data file contains no description or column header rows,1/3/95 36.75 36.9063 36.6563 36.875 1167900 1/4/95 37 37.2813 36.625 37.1563 1994700 ...

you can create a financial time series object from it with the simplest form of the ascii2fts function:myinc = ascii2fts('my_inc.dat'); myinc = desc: my_inc.dat freq: Unknown (0) 'dates: (2)' 'series1: (2)' 'series2: (2)' 'series3: (2)'... '03-Jan-1995' [ 36.7500] [ 36.9063] [ 36.6563] '04-Jan-1995' [ 37] [ 37.2813] [ 36.6250]

Example 2: If your data file contains description and column header information with the data series immediately following the column header row,International Business Machines Corporation (IBM) Daily prices (1/3/95 to 4/5/99) DATE OPEN HIGH LOW CLOSE VOLUME 1/3/95 36.75 36.9063 36.6563 36.875 1167900 1/4/95 37 37.2813 36.625 37.1563 1994700 ...

you must specify the row numbers containing the description and column headers:ibm = ascii2fts('ibm9599.dat', 1, 3); ibm = desc: International Business Machines Corporation (IBM) freq: Unknown (0) 'dates: (2)' 'OPEN: (2)' 'HIGH: (2)' 'LOW: (2)' ... '03-Jan-1995' [ 36.7500] [ 36.9063] [ 36.6563] '04-Jan-1995' [ 37] [ 37.2813] [ 36.6250]

Example 3: If your data file contains rows between the column headers and the data series, for example,Staples, Inc. (SPLS) Daily prices DATE OPEN HIGH LOW CLOSE VOLUME Starting date: 04/08/1996 Ending date: 04/07/1999 4/8/96 19.50 19.75 19.25 19.375 548500 4/9/96 19.75 20.125 19.375 20 1135900 ...

you need to indicate to ascii2fts the rows in the file that must be skipped. Assume that you have called the data file containing the Staples data above staples.dat. The commandspls = ascii2fts('staples.dat', 1, 3, [4 5]);

indicates that the fourth and fifth rows in the file should be skipped in creating the financial time series object:spls = desc: Staples, Inc. (SPLS) freq: Unknown (0) 'dates: (2)' 'OPEN: (2)' 'HIGH: (2)' 'LOW: (2)' '08-Apr-1996' [ 19.5000] [ 19.7500] [19.2500] '09-Apr-1996' [ 19.7500] [ 20.1250] [19.3750]

Example 4: Create a financial time series object containing time-of-day information.

First 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)); stat = fts2ascii('myfts_file2.txt',serial_dates_times,data, ... {'dates';'times';'Data1';'Data2'},'My FTS with Time');

Now read the data file back and create a financial time series object:MyFts = ascii2fts('myfts_file2.txt','t',1,2,1) MyFts = desc: My FTS with Time freq: Unknown (0) 'dates: (6)' 'times: (6)' 'Data1: (6)' 'Data2: (6)' '01-Jan-2001' '11:00' [ 9] [ 4] ' " ' '12:00' [ 7] [ 9] '02-Jan-2001' '11:00' [ 2] [ 1] ' " ' '12:00' [ 4] [ 4] '03-Jan-2001' '11:00' [ 9] [ 8] ' " ' '12:00' [ 9] [ 0] 你有序列号码吗,如果有借我用一下,请发到邮箱fc13240@163.com

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值