[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem using fscanf
From: |
Bård Skaflestad |
Subject: |
Re: Problem using fscanf |
Date: |
Thu, 14 Apr 2011 15:29:17 +0200 |
On Thu, 2011-04-14 at 15:11 +0200, Doug Stewart wrote:
>
>
> On Thu, Apr 14, 2011 at 6:34 AM, Utherr13 <address@hidden>
> wrote:
> I have a file which has integers in a 100x2 matrix. I want to
> get the second
> column and put it in a variable, in which i used a for 1:100,
> but on the i+1
> (from the second) the variable is "[](0x1)"
>
> for i=1:100
> z = fscanf(f,'%d',1);
> a = fscanf(f,"%d",1);
> disp(a);
> endfor
>
> --
>
>
> Try This
>
>
> for i=1:100
> z(i) = fscanf(f,'%d',1);
> a(i) = fscanf(f,"%d",1);
> disp(a);
> endfor
>
Or maybe even this (the [2,100] shape + transpose is essential):
t = fscanf(f, '%d', [2, 100]) .';
z = t(:,1);
a = t(:,2); disp(a)
Sincerely,
--
Bård Skaflestad <address@hidden>
SINTEF ICT, Applied Mathematics
- Problem using fscanf, Utherr13, 2011/04/14
- Re: Problem using fscanf, Doug Stewart, 2011/04/14
- Re: Problem using fscanf,
Bård Skaflestad <=
- Re: Problem using fscanf, Utherr13, 2011/04/15
- Re: Problem using fscanf, Bård Skaflestad, 2011/04/15
- octave from java, frank buloup, 2011/04/15
- Re: octave from java, George Kousiouris, 2011/04/15
- Re: octave from java, Kim Hansen, 2011/04/15
- Re: octave from java, Utherr13, 2011/04/15
- Re: octave from java, frank buloup, 2011/04/15
- Re: octave from java, Kim Hansen, 2011/04/17
- Re: Problem using fscanf, Utherr13, 2011/04/15
- Re: Problem using fscanf, Bård Skaflestad, 2011/04/15