【问题标题】:Load File TxT Matlab/Octave加载文件 TxT Matlab/Octave
【发布时间】:2013-04-22 10:59:11
【问题描述】:

如何在矩阵 A 中加载包含以下内容的 txt 文件:

n
a11 a12
a21 a22
a31 a32
.......
an1 an2

n - 行数,它是一个 int 和 a11...an2 是浮点类型

假设 n = 3 我会有这样的东西:

3
1.5 1.8
84.21 15.2
41.5 2.0

因此我的矩阵 A 将是:[1.5 1.8; 84.21 15.2; 41.5 2.0]

【问题讨论】:

  • A = textread("file", "headerlines", 1);?

标签: matlab matrix octave readfile


【解决方案1】:

您可以通过以下方式做到这一点:

  1. A = textread('a.txt', '', 'headerlines', 1);
  2. A = dlmread('a.txt', ' ', 1)

【讨论】:

    猜你喜欢
    • 2013-06-27
    • 2017-02-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-02
    • 1970-01-01
    • 2017-09-21
    相关资源
    最近更新 更多