[Top][All Lists]

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

Re: how to split a char buffer to lines?

From: Paul Kienzle
Subject: Re: how to split a char buffer to lines?
Date: Tue, 18 Jun 2002 09:12:27 -0400

On Tue, Jun 18, 2002 at 09:05:27AM -0400, Ted Sariyski wrote:
> Hi,
> I am new with octave. I tried to port one script from matlab to octave but 
> hit 
> two problems. The first is how to split a long string to '\n'? I used to read 
> the text file into a buffer:
> #> fd = fopen('file.txt')
> #> buffer=setstr(fread(fd, inf, 'char')');
> and build an index array where '\n' is:
> #> newlines_index = find(buffer == 10);

        find(buffer == '\n')


        find(toascii(buffer) == 10)

> It returns an error:
> #> error: invalid conversion from string to real matrix
> #> error: type conversion failed for binary operator `=='
> The second question is how to save a plot in a ps format. There is no 'print 
> -dps ' in octave.

There is in octave-forge (  Otherwise, you have to do
something like:

        gset terminal postscript
        gset output
        gset terminal x11

Paul Kienzle

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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