[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: reading data stored in a file: to Jordi
From: |
Jaroslav Hajek |
Subject: |
Re: reading data stored in a file: to Jordi |
Date: |
Sat, 10 Jul 2010 09:58:24 +0200 |
2010/7/9 John W. Eaton <address@hidden>:
> On 9-Jul-2010, Jordi Gutiérrez Hermoso wrote:
>
> | On 9 July 2010 14:21, Nibalart <address@hidden> wrote:
> | > your first line works if I erase the word file. From the display I
> | > understand that everything is stored in a matrix. When I run the second
> line
> | > the answer is:
> | >
> | >>>> [v1 v2 v3 v4 v5] = [v(:,1) v(:,2) v(:,3) v(:,4) v(:,5)]
> | >
> | > error: invalid number of output arguments for matrix list
> |
> | Sorry, as Jaroslav pointed out, that was a mistake. I've been coding
> | in Python recently, and got my wires crossed. You'll have to do
> | instead v1 = v(:,1); v2 = v(:,2); v3 = v(:,3) and so on.
>
> Or:
>
> [v1, v2, v3, v4, v5] = deal (v(:,1), v(:,2), v(:,3), v(:,4), v(:,5));
>
Or:
[vc{1:5}] = num2cell (v, 1){:};
:-)
--
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz