help-octave
[Top][All Lists]
Advanced

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

Re: SUPER newbie question


From: Mike Miller
Subject: Re: SUPER newbie question
Date: Fri, 4 Oct 2002 00:41:11 -0500 (CDT)

On Fri, 4 Oct 2002, Andy Dykes wrote:

> This is probably a trivial question for most of you, but why doesn't my
> function, written for matlab, work in octave?


This was your function:

function [nudeg] = nu(M1,gamma)
temp3 = sqrt (M1 * M1 - 1);
temp2 = atan(sqrt((gamma-1)/(gamma+1))*temp3);
temp2 = temp2 * sqrt((gamma+1)/(gamma-1))-atan(temp3);
nudeg = temp2 * 90/pi/2;


It worked fine for me -- after I translated the carriage returns to
newlines!

tr '\r' '\n' < nu.m > nu2.m ; mv nu2.m nu.m

I'm not sure how you made that file, probably on a Macintosh, right?
Anyway, here's an excerpt from a message I wrote the other day...


I know of four different formats for text files:

source: http://ddl.jpl.nasa.gov/ddl/purpose/multiplat.pdf

IBM PC
   This is a line of text.<CR><LF>
Macintosh
   This is a line of text.<CR>
UNIX workstation
   This is a line of text.<LF>
VAX/VMS workstation
   <LENGTH>This is a line of text.*

* This is the most common format supported under VMS.


Here's a nice perl script for dos2unix conversion:

#!/usr/bin/perl -i -p
s/\r$//

I think this perl script will work for mac2unix conversion:

#!/usr/bin/perl -i -p
s/\r/\n/g

Both scripts, once made executable and placed in your path, will allow you
to use multiple filenames and wildcards.  For example, name the second one
m2u and do this in an appropriate directory on your unix machine:

m2u *.m

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]