help-octave
[Top][All Lists]
Advanced

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

Re: How to suppress unneeded output while using "save"


From: Mike Miller
Subject: Re: How to suppress unneeded output while using "save"
Date: Tue, 6 Dec 2005 08:30:57 -0600 (CST)

On Tue, 6 Dec 2005 address@hidden wrote:

Dear ladies and gentlemen!
I use the command "save" to save  a matrix in a data-file. That works pretty
well.
But octave also writes the following information in this data-file:

# Created by Octave 2.1.57, Sun Dec 04 12:37:37 2005
# name: speedsc1
# type: matrix
# rows: 30
# columns: 337

How can I suppress this additional output?


Here's a perl script I wrote for removing header lines. This overwrites files and can be used on collections of files using wildcard characters. Suppose you name this script "no_headers" then you could do things like this:

no_headers *.out outfiles/*


------------------------begin script on next line----------------------
#!/usr/bin/perl -i -p

# This removes the initial header lines of an octave ascii data file

BEGIN{undef $/} s/(# [^\n]*\n)+ / /
------------------------end script on previous line--------------------


Someone claimed that if you remove the header information, you cannot reload the matrix in Octave. That depends. If the file holds a single matrix, you can still use "load" to bring that matrix into Octave, but you will have to give it an appropriate name.

I assume that you want remove the header info because you want to import the data into a different program.

Mike



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

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