[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')
OR
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 (http://octave.sf.net). Otherwise, you have to do
something like:
gset terminal postscript
gset output file.ps
replot
gset terminal x11
Paul Kienzle
address@hidden
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------