|
View:
New views
11 Messages
—
Rating Filter:
Alert me
|
|
|
Loading DataI'm a complete noob here, but I'm having trouble loading data into octave using a script. I can do it from the command line no problem by doing the following:
load ('torque.txt'); x = torque; plot (x); but within a script it pukes when trying to assign x. Any ideas? BTW, I'm using Windows and the latest version of Octave. Thanks, Tweed |
|
|
Re: Loading DataOn Saturday 09 February 2008 12:40, TweedleDee wrote:
> I'm a complete noob here, but I'm having trouble loading data into > octave using a script. I can do it from the command line no problem > by doing the following: > > load ('torque.txt'); > x = torque; > plot (x); > > but within a script it pukes when trying to assign x. Any ideas? > BTW, I'm using Windows and the latest version of Octave. Thanks, This sounds like a problem between global scope and local scope. try saying: global torque kensmith99@... _______________________________________________ Help-octave mailing list Help-octave@... https://www.cae.wisc.edu/mailman/listinfo/help-octave |
|
|
Re: Loading Data
I'm still getting the same errors... >C:\Program Files\Octave\bin\octave.exe -q "loadFileTest.m" - Use `pkg list' to see a list of installed packages. - SciTE editor installed. Use `edit' to start the editor. - MSYS shell available (C:\Program Files\Octave\msys). - Graphics backend: jhandles. t = 1 2 3 4 5 6 7 8 9 10 error: value on right hand side of assignment is undefined error: evaluating assignment expression near line 3, column 3 error: near line 3 of file `loadFileTest.m' >Exit code: 1 |
|
|
Re: Loading DataOn Sunday 10 February 2008 08:54, TweedleDee wrote:
> kensmith wrote: > > On Saturday 09 February 2008 12:40, TweedleDee wrote: > >> I'm a complete noob here, but I'm having trouble loading data into > >> octave using a script. I can do it from the command line no > >> problem by doing the following: > >> > >> load ('torque.txt'); >From the Help system: If load is invoked using the functional form load ("-text", "file.txt", "a") then the OPTIONS, FILE, and variable name arguments (V1, ...) must be specified as character strings. What you have appears to be the function form. Perhaps it isn't parsed the same when it is read from a file instead of from the terminal. Try doing it exactly like the example line and see what happens. > >> x = torque; > >> plot (x); > >> > >> but within a script it pukes when trying to assign x. Any ideas? > >> BTW, I'm using Windows and the latest version of Octave. Thanks, > > > > This sounds like a problem between global scope and local scope. > > > > try saying: > > > > global torque > > > > kensmith99@... > > _______________________________________________ > > Help-octave mailing list > > Help-octave@... > > https://www.cae.wisc.edu/mailman/listinfo/help-octave > > I'm still getting the same errors... > > >C:\Program Files\Octave\bin\octave.exe -q "loadFileTest.m" > > - Use `pkg list' to see a list of installed packages. > - SciTE editor installed. Use `edit' to start the editor. > - MSYS shell available (C:\Program Files\Octave\msys). > - Graphics backend: jhandles. > > t = > > 1 2 3 4 5 6 7 8 9 10 > > error: value on right hand side of assignment is undefined > error: evaluating assignment expression near line 3, column 3 > error: near line 3 of file `loadFileTest.m' > > >Exit code: 1 -- kensmith99@... _______________________________________________ Help-octave mailing list Help-octave@... https://www.cae.wisc.edu/mailman/listinfo/help-octave |
|
|
Re: Loading DataIf load is invoked using the functional form load ("-text", "file.txt", "a") then the OPTIONS, FILE, and variable name arguments (V1, ...) must be specified as character strings. What you have appears to be the function form. Perhaps it isn't parsed the same when it is read from a file instead of from the terminal. Try doing it exactly like the example line and see what happens. Thanks for the help, but I tried that method already. When I use that I get the following error message: error: load: empty name keyword or no data found in file The file I'm trying to load is an array of floating point numbers in text format... 0.0000 7.4533 7.6765 8.6432 etc... I can load it in Matlab or the Octave command window without any trouble. |
|
|
Re: Loading Data
Okay, I figured out what my problem was. I was trying to use the path and filename together in the load command. I should have been using the path command to set the path first. path = 'C:\Program Files\Octave\Alan'; load ("TorqueArray.txt") x = TorqueArray; plot (x); Tweed |
|
|
Re: Loading DataOn 2/10/08, kensmith <kensmith99@...> wrote:
> > >> load ('torque.txt'); Try x = load ('toque.txt') Michael. _______________________________________________ Help-octave mailing list Help-octave@... https://www.cae.wisc.edu/mailman/listinfo/help-octave |
|
|
Re: Loading DataOn 10-Feb-2008, TweedleDee wrote:
| Okay, I figured out what my problem was. I was trying to use the path and | filename together in the load command. I should have been using the path | command to set the path first. | | path = 'C:\Program Files\Octave\Alan'; | load ("TorqueArray.txt") I don't see how defining a variable called "path" could possibly have any effect on the load function. It's difficult to say whether you've found a bug that should be fixed since I don't think you have yet provided enough information for someone to actually reproduce the problem you're having. Can you give a complete example (data file, preferably small) and the *exact* functions required and the commands you typed so that someone might be able to reproduce the problem you had? Thanks, jwe _______________________________________________ Help-octave mailing list Help-octave@... https://www.cae.wisc.edu/mailman/listinfo/help-octave |
|
|
Re: Loading DataOn Saturday 09 February 2008 12:40, TweedleDee wrote:
> I'm a complete noob here, but I'm having trouble loading data into > octave using a script. I can do it from the command line no problem > by doing the following: > > load ('torque.txt'); > x = torque; > plot (x); Another thought: What does the windows version do about the stupid wrong way slash for directories? is it load('C:\somedirectory\somefile.txt') or load('C:\\somedirectory\\somefile.txt') or load(D:/somedirectory/somefile.txt') > > but within a script it pukes when trying to assign x. Any ideas? > BTW, I'm using Windows and the latest version of Octave. Thanks, > > Tweed -- kensmith99@... _______________________________________________ Help-octave mailing list Help-octave@... https://www.cae.wisc.edu/mailman/listinfo/help-octave |
|
|
Re: Loading DataOn 2/12/08, kensmith <kensmith99@...> wrote:
> Another thought: > > What does the windows version do about the stupid wrong way slash for > directories? > > is it > > load('C:\somedirectory\somefile.txt') > or > load('C:\\somedirectory\\somefile.txt') > > or > load(D:/somedirectory/somefile.txt') All 3 should work OK. If you use double quotes instead, the first statement will not work. Michael. _______________________________________________ Help-octave mailing list Help-octave@... https://www.cae.wisc.edu/mailman/listinfo/help-octave |
|
|
RE: Loading Data> -----Original Message----- > From: Michael Goffioul [mailto:michael.goffioul@...] > > On 2/12/08, kensmith <kensmith99@...> wrote: > > Another thought: > > > > What does the windows version do about the stupid wrong way > > slash for directories? > > > > is it > > > > load('C:\somedirectory\somefile.txt') > > or > > load('C:\\somedirectory\\somefile.txt') > > > > or > > load(D:/somedirectory/somefile.txt') > > All 3 should work OK. If you use double quotes instead, the > first statement will not work. #2 ('\\') doesn't work for me from command line. Funny though, it does work with double quotes. I suppose there is some interaction with Windows' method of interpreting commands, but I can't get my mind around it this time of the morning. Regards, Allen _______________________________________________ Help-octave mailing list Help-octave@... https://www.cae.wisc.edu/mailman/listinfo/help-octave |
| Free embeddable forum powered by Nabble | Forum Help |