[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Beginner Issues using octave from bash script
From: |
Bob Walton |
Subject: |
Re: Beginner Issues using octave from bash script |
Date: |
Mon, 14 Jan 2013 06:08:26 -0800 (PST) |
epetting wrote
> Greetings,
>
> I'm having an issue implementing octave using bash script. When I run the
> bash script, an octave terminal window opens and an error message appears
> which says the following (and no Attempt.pdf is created in this process):
>
> warning: function ./test.m shadows a core library function
> octave-3.4.0:1>
>
> My bash script is of the following:
> ==========
> #!/bin/bash
> #Run test.m via this file (testm.sh)
>
> cd /Users/ep/
> echo "Octave running"
> Title="Insert Title Here";
> octave --silent --eval "test ('$Title')"
> echo "Octave done"
> ==========
>
> And my octave script:
> ==========
> % Plotting and saving, to be used from within a .sh file (testm.sh)
>
> x=[4,3];
> y=[3,4];
> disp(Title);
>
> cd /Users/ep/
> figure
> hold on;
> plot(x,y);
> str=sprintf("%s",Title);
> title(str);
> hold off;
> print -dpdf Attempt.pdf
> ===========
>
>
> Also, in the original terminal window, "Octave running" and "Octave done"
> is printed.
First, as others have mentioned, "test.m" is already a core Octave function
-- so you should
rename it to something else, like "test2.m", maybe. Second, you defined
your "test.m" as
an Octave script, not a function, and then proceeded to call it as a
function. If you add the line:
function test2(Title)
as the first line of your test.m, I think you will get the results you
desire. The name given
as "test2" above should be changed to whatever you renamed your "test.m"
file to.
--
Bob Walton, bob at bwalton dot com
--
View this message in context:
http://octave.1599824.n4.nabble.com/Beginner-Issues-using-octave-from-bash-script-tp4648750p4648849.html
Sent from the Octave - General mailing list archive at Nabble.com.