[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to plot from script in macbook pro
From: |
Ben Abbott |
Subject: |
Re: how to plot from script in macbook pro |
Date: |
Sat, 06 Apr 2013 13:20:26 -0400 |
**** Please reply below and keep the help-list cc'd ***
On Apr 6, 2013, at 11:20 AM, saurabh sakpal wrote:
> > Subject: Re: how to plot from script in macbook pro
> > From: address@hidden
> > Date: Sat, 6 Apr 2013 10:54:47 -0400
> > CC: address@hidden
> > To: address@hidden
> >
> > On Apr 6, 2013, at 10:11 AM, saurabh sakpal wrote:
> >
> > > > Subject: Re: how to plot from script in macbook pro
> > > > From: address@hidden
> > > > Date: Sat, 6 Apr 2013 08:41:31 -0400
> > > > CC: address@hidden
> > > > To: address@hidden
> > > >
> > > > On Apr 6, 2013, at 4:05 AM, address@hidden wrote:
> > > >
> > > > > I am very much a beginner on octave on macbook pro. I can plot from
> > > > > the command line on octave, but when i try to run from a script(which
> > > > > i have saved to a text editor and saved with .m) and call on that
> > > > > script for e.g.;
> > > > >
> > > > > ">>myscript " it says invalid use of script index expression.
> > > > >
> > > > > This is my code on the script ( i have even named the filename so
> > > > > that it doesnt coincide with a function)
> > > > >
> > > > > t=[0:.1:100];
> > > > > u=-1+0.02*t;
> > > > > y=sin(0.2*t);
> > > > > plot(t,y,t,u)
> > > > > %y (y-axis) is plotted against t (x-axis)
> > > > > %and u (y-axis) is plotted against t (x-axis).
> > > >
> > > >
> > > > I'd guess the script was created using TextEdit? Likely *not* saved as
> > > > a simple text file?
> > > >
> > > > Try editing the file and save it with Unicode (UTF-8) plain text
> > > > encoding. Be the file name ends with ".m" and contains no additional
> > > > periods.
> > > >
> > > > Ben
> > > >
> > >
> > > Thanks but i did save my file as 'plain text' and ended it with a .m
> > > suffix too. is there another way?
> > >
> > > Thanks again
> >
> > Please reply below and keep the help-list cc'd
> >
> > Please copy-n-paste the entire error you get.
> >
> > What does "type mscript.m" return. Again, please copy-n-paste everything.
> >
> > Ben
> >
> <Screen Shot 2013-04-07 at 2.45.24 AM.png>
>
> Well heres the screenshot of the screen and the error while i am running,i
> get to give u an idea.
> heres the error message again;
>
> error: invalid use of script /Users/saurabhsakpal/Desktop/plot.m in index
> expression
> error: called from:
> error: /Users/saurabhsakpal/Desktop/plotintro.m at line 6, column 1
>
> I see there might be something wrong with my text editor? i did some research
> and u need utf-8 what is this exactly? Thanks again for your help.
The first line of the error indicates that you've created a script name
"plot.m" and saved it to your desktop.
error: invalid use of script /Users/saurabhsakpal/Desktop/plot.m in
index expression
When you try to use the "plot()" function in your script, plotintro.m, Octave
tries to use the plot.m file on your Desktop as a function.
Ben