zoukankan      html  css  js  c++  java
  • 【转】matab中dlmread 和dlmwrite函数的具体应用

    转自:http://www.ymlib.net/article/sort010/info-376.html

    matab中dlmread 和dlmwrite函数的基本格式:
    M = dlmread(filename, delimiter, R, C)
    M = dlmread(filename, delimiter, range)
    range = [R1 C1 R2 C2] where (R1,C1) is the upper left corner of the data to be read and (R2,C2) is the lower right corner. You can also specify the range using spreadsheet notation, as in range = 'A1..B7'.
    示例:



    dlmwrite: Write matrix to ASCII-delimited file

    1、定义输出格式:dlmwrite(filename, M, 'attrib1', value1, 'attrib2', value2, ...) is an alternate syntax to those shown above, in which you specify any number of attribute-value pairs in any order in the argument list.
    属性定义:
    delimiter(分割符): Delimiter string to be used in separating matrix elements.
    newline(断行符):Character(s) to use in terminating each line.
    (1) 'pc': PC terminator (implies carriage return/line feed (CR/LF))
    (2) 'unix': UNIX terminator (implies line feed (LF))
    roffset(行偏移): Offset, in rows, from the top of the destination file to where matrix data is to be written. Offset is zero based.
    coffset(列偏移): Offset, in columns, from the left side of the destination file to where matrix data is to be written. Offset is zero based.
    precision(输出精度): Specify the number of significant digits or a C-style format string starting in %, such as '%10.5f'.
    示例:
    dlmwrite('data.txt', data, 'precision', '%10.6f', 'roffset', 10, 'coffset', 10, 'delimiter', ';', 'newline', 'pc');


    2、追加方式输出:dlmwrite(filename, M, '-append', attribute-value list) appends the matrix to the file. If you do not specify '-append', dlmwrite overwrites any existing data in the file. You can place the '-append' flag in the argument list anywhere between attribute-value pairs, but not in between an attribute and its value.
     

  • 相关阅读:
    Fitness
    【代码优化】Unity查漏补缺
    Fitness
    MonoBehaviour生命周期与对象数据池应用
    Fitness
    点、向量、方向在局部与世界坐标系转换的对比
    在企业运营中的感触
    技术杂想2015年夏天
    Heimich manoeuvre 海姆利克氏操作
    徒手CPR心脏复苏
  • 原文地址:https://www.cnblogs.com/fzzl/p/2175343.html
Copyright © 2011-2022 走看看