文字列、double、char などで構成される複雑な csv ファイルをどのように読み取るべきなのか疑問に思っています。
たとえば、この csv ファイルで数値を抽出できる成功したコマンドを教えてください。
ここをクリックしてください。
例えば:
yield curve data 2013-10-04
Yields in percentages per annum.
Parameters - AAA-rated bonds
Series key Parameters Description
YC.B.U2.EUR.4F.G_N_A.SV_C_YM.BETA0 2.03555 Euro area (changing composition) - Government bond, nominal, all issuers whose rating is triple A - Svensson model - continuous compounding - yield error minimisation - Yield curve parameters, Beta 0 - Euro, provided by ECB
YC.B.U2.EUR.4F.G_N_A.SV_C_YM.BETA1 -2.009068 Euro area (changing composition) - Government bond, nominal, all issuers whose rating is triple A - Svensson model - continuous compounding - yield error minimisation - Yield curve parameters, Beta 1 - Euro, provided by ECB
YC.B.U2.EUR.4F.G_N_A.SV_C_YM.BETA2 24.54184 Euro area (changing composition) - Government bond, nominal, all issuers whose rating is triple A - Svensson model - continuous compounding - yield error minimisation - Yield curve parameters, Beta 2 - Euro, provided by ECB
YC.B.U2.EUR.4F.G_N_A.SV_C_YM.BETA3 -21.80556 Euro area (changing composition) - Government bond, nominal, all issuers whose rating is triple A - Svensson model - continuous compounding - yield error minimisation - Yield curve parameters, Beta 3 - Euro, provided by ECB
YC.B.U2.EUR.4F.G_N_A.SV_C_YM.TAU1 5.351378 Euro area (changing composition) - Government bond, nominal, all issuers whose rating is triple A - Svensson model - continuous compounding - yield error minimisation - Yield curve parameters, Tau 1 - Euro, provided by ECB
YC.B.U2.EUR.4F.G_N_A.SV_C_YM.TAU2 4.321162 Euro area (changing composition) - Government bond, nominal, all issuers whose rating is triple A - Svensson model - continuous compounding - yield error minimisation - Yield curve parameters, Tau 2 - Euro, provided by ECB
これらは、ファイル内の情報の一部です。そしてcsvread('yc_latest.csv', 6, 1, [6,1,6,1])
、値 2.03555 を取得しようとしましたが、次のエラーが発生しました。
Error using dlmread (line 139)
Mismatch between file and format string.
Trouble reading number from file (row 1u, field 3u) ==> "Euro area (changing composition) -
Government bond, nominal, all issuers whose rating is triple A - Svensson model - continuous
compounding - yield error minimisation - Yield curve parameters, Beta 0
Error in csvread (line 50)
m=dlmread(filename, ',', r, c, rng);