[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bizarre Error
From: |
Miquel Cabanas |
Subject: |
Re: Bizarre Error |
Date: |
Wed, 12 Feb 2003 09:44:14 +0100 |
User-agent: |
Mutt/1.3.28i |
On Wed, Feb 12, 2003 at 03:30:01PM +1100, address@hidden wrote:
>
> Heres an interesting one:
> I created a menu system to read in all the files in a directory
> and then list them 10 at a time allowing users to change pages
> or to select a file.
why don't you use the menu () m-function available in Octave, it
seems to do the job you want.
as for the error,
> parse error:
>
> >>> load -force materials/B45505.mtl
> parse error:
>
> error: invalid character `' (ASCII 0) near line 49, column 45
>
> [...]
>
> >>> load -force materials/B45505.mtl
> error: evaluating for command near line 23, column 3
I'm not convinced it's related to str2num. I rather suspect it's
related to the use of "filelist(i,:)" in the eval () within the for
loop.
> filelist=filelist(mtlfiles,:);
...
> for i=Cpage_start:Cpage_finish
> loadline=['load -force materials/',filelist(i,:),' matname'];
> eval(loadline);
String matrices are padded with zeros so that all rows have
the same length, if you want to get a string back and use it without
problems you better strip it down and remove all extra space chars
from its end using deblank (). I.e.
octave:145> filelist
filelist =
getmat.m
getmatv.m
pand9613.m
octave:146> size (filelist)
ans =
3 38
octave:147> size (filelist(1,:))
ans =
1 38
octave:148> size (deblank (filelist(1,:)))
ans =
1 8
octave:149> deblank (filelist(1,:))
ans = getmat.m
Try replacing
> loadline=['load -force materials/',filelist(i,:),' matname'];
with
> loadline=['load -force materials/',deblank (filelist(i,:)),' matname'];
Miquel
--
Miquel E Cabanas ------------------------------------------------------
SeRMN, Universitat Autonoma de Barcelona (address@hidden)
------------------------------------------o-oo--ooo---ooo--oo-o--------
-------------------------------------------------------------
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
-------------------------------------------------------------
- Bizarre Error, pand9613, 2003/02/11
- Re: Bizarre Error,
Miquel Cabanas <=