help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem: importing text


From: Jaroslav Hajek
Subject: Re: problem: importing text
Date: Mon, 5 Oct 2009 15:05:02 +0200

On Mon, Oct 5, 2009 at 10:46 AM, s4y <address@hidden> wrote:
>
> Hi, i have question regarding the import of a text in a file.
> The file looks like this:
> Tasd            Bs      Req  wr Dqw  rqr        hy
> 3:04:34 5.34    -3      3       45.6    -3      3
> 3:03:34 5.34    -35     6       45.6    -35     6
> 3:43:2  5.34    -35     6       45.6    -35     6
>
> I used the command: "textline = fgetl(fid);" to import the text line.
> The output of textline is:
> Tasd    Bs      Req  wr Dqw  rqr        hy
>
> The point is that he saves just the letters in a column.
> Like this: A=textline(:,1)
> A=T
>
> But i need the whole word "Tasd". Is there a way to extract the whole word
> till the blankspace without using
> A=textline(:,1:4). I need to change the word "Tasd" in the file and that
> includes adding or removing letters.
> When i save it with this command:
> H = fscanf(fid, '%s %s %s %s %s %s%s', [7 1]);
> He still saves just the letters not the whole words between the blankspaces.
> Hopefully somenone can help me or givem i a hint.
> Thanks in advance.
> Sebastian
> --

try using
 fscanf(fid, '%s %s %s %s %s %s%s', 'C');

for other, often more convenient options, see
help strsplit (split a string into delimited parts)
help dlmread (parse a file with delimited table)

regards

-- 
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]