0

How can I load in a matrix A a txt file which has this content:

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

n - number of lines and it's an int and a11...an2 are float types

Let's say for n = 3 I would have something like this:

3
1.5 1.8
84.21 15.2
41.5 2.0

Threfore my matrix A would be : [1.5 1.8; 84.21 15.2; 41.5 2.0]

4

1 回答 1

1

您可以通过以下方式执行此操作:

  1. A = textread('a.txt', '', 'headerlines', 1);
  2. A = dlmread('a.txt', ' ', 1)
于 2013-04-22T11:16:08.587 回答