importdata-- matlab

source file: test.dat

***************************

Day1  Day2  Day3  Day4  Day5  Day6  Day7
95.01 76.21 61.54 40.57  5.79 20.28  1.53
23.11 45.65 79.19 93.55 35.29 19.87 74.68
60.68  1.85 92.18 91.69 81.32 60.38 44.51
48.60 82.14 73.82 41.03  0.99 27.22 93.18
89.13 44.47 17.63 89.36 13.89 19.88 46.60

*******************

matlab code:

A = importdata('test.dat',delimiterIn,headerlinesIn)

- loads data from *ASCII* file, filename, or the clipboard
- delimiterIn :: column separator character, such as empty space is expressed as  ''
- headerlinesIn :: reading numeric data starting from line *headerlinesIn+1*.

 

>> a= importdata('test.dat','', 2)
a =

  scalar structure containing the fields:

    data =

     Columns 1 through 4:

       23.11000   45.65000   79.19000   93.55000
       60.68000    1.85000   92.18000   91.69000
       48.60000   82.14000   73.82000   41.03000
       89.13000   44.47000   17.63000   89.36000

     Columns 5 through 7:

       35.29000   19.87000   74.68000
       81.32000   60.38000   44.51000
        0.99000   27.22000   93.18000
       13.89000   19.88000   46.60000

    textdata =
    {
      [1,1] = Day1  Day2  Day3  Day4  Day5  Day6  Day7
      [2,1] = 95.01 76.21 61.54 40.57  5.79 20.28  1.53
    }
    colheaders =
    {
      [1,1] = 95.01
      [1,2] = 76.21
      [1,3] = 61.54

 

转载于:https://www.cnblogs.com/code-saturne/p/10483858.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值