afullo | 20 Mar 16:21 2013
Picon

Octave: invalid use of script in index expression

I've got some script, but one of them doesn't work properly. Specifically,
HaltonProva gives:

/error: invalid use of script in index expression
error: called from:
error:   /home/fabio/Matematica/Meshfree/HaltonProva.m at line 19, column 4/

where the script and its calls follow (they are in distinct .m files, just
listed consecutively here):

/%%% HaltonProva.m

% bidimensionale
% x = HaltonSequence(100,2);
% y = HaltonSequence(100,3);
% plot(x,y,'.o')
% axis([0 1 0 1])
% axis square

% tridimensionale
% x = HaltonSequence(500,2);
% y = HaltonSequence(500,3);
% z = HaltonSequence(500,5);
% plot3(x,y,z,'.o')
% axis square
% grid on

% prova con la fill distance
xh = HaltonSequence(25,2);
yh = HaltonSequence(25,3);
(Continue reading)

c. | 20 Mar 17:14 2013
Picon

Re: Octave: invalid use of script in index expression


On 20 Mar 2013, at 16:21, afullo <fabio.roman <at> unito.it> wrote:

> I've got some script, but one of them doesn't work properly. Specifically,
> HaltonProva gives:
> 
> /error: invalid use of script in index expression
> error: called from:
> error:   /home/fabio/Matematica/Meshfree/HaltonProva.m at line 19, column 4/
> 
> where the script and its calls follow (they are in distinct .m files, just
> listed consecutively here):

Ciao Fabio,

The error is exactly what the error message says, on line 19 of HaltonProva.m you have:

hh = FillDistance(xh,yh)

but FillDistance is neither a vector that can be indexed as FillDistance(…)  
nor a function that takes input arguments in parentheses, but rather a script file, 
so this line makes no sense.

BTW, if your file FillDistance.m is really as you wrote it:

%%% FillDistance.m

hX = FillDistance(x,y)
neval = 40;
grid=linspace(0,1,neval);
(Continue reading)

Julien Bect | 20 Mar 17:23 2013
Picon
Picon

Re: Octave: invalid use of script in index expression

On 20/03/2013 17:14, c. wrote:
> %%% FillDistance.m
>
> hX = FillDistance(x,y)
> neval = 40;
> grid=linspace(0,1,neval);
> [xe,ye]=meshgrid(grid);
> epoints=[xe(:) ye(:)];
> ctrs=[x y];
> DM_eval=DistanceMatrix(epoints,ctrs);
> hX=max(min(DM_eval'));

What about simply adding the keyword 'function' on the first line, like 
this :

function hX = FillDistance(x,y)

?
afullo | 21 Mar 14:28 2013
Picon

Re: Octave: invalid use of script in index expression

It worked just by adding "function". :D

Thanks all. :)

--
View this message in context: http://octave.1599824.n4.nabble.com/Octave-invalid-use-of-script-in-index-expression-tp4651057p4651094.html
Sent from the Octave - General mailing list archive at Nabble.com.
Carlo de Falco | 20 Mar 17:12 2013
Picon

Re: Octave: invalid use of script in index expression


On 20 Mar 2013, at 16:21, afullo <fabio.roman <at> unito.it> wrote:

> I've got some script, but one of them doesn't work properly. Specifically,
> HaltonProva gives:
> 
> /error: invalid use of script in index expression
> error: called from:
> error:   /home/fabio/Matematica/Meshfree/HaltonProva.m at line 19, column 4/
> 
> where the script and its calls follow (they are in distinct .m files, just
> listed consecutively here):

Ciao Fabio,

The error is exactly what the error message says, on line 19 of HaltonProva.m you have:

hh = FillDistance(xh,yh)

but FillDistance is neither a vector that can be indexed as FillDistance(…)  
nor a function that takes input arguments in parentheses, but rather a script file, 
so this line makes no sense.

BTW, if your file FillDistance.m is really as you wrote it:

%%% FillDistance.m

hX = FillDistance(x,y)
neval = 40;
grid=linspace(0,1,neval);
(Continue reading)


Gmane