help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: parse error when accessing meshgrid elements


From: c.
Subject: Re: parse error when accessing meshgrid elements
Date: Wed, 25 Jun 2014 11:34:57 +0200

On 25 Jun 2014, at 06:50, rcharan51 <address@hidden> wrote:

> ok i itried to use arrayfun by using following commands
> dd=arrayfun(getz, xx);

this is not the correct way to use arrayfun.
have you tried reading the help before using it?

Try 

help arrayfun 

This will tell you that

"The first input argument FUNC can be a string, a function handle,
 an inline function, or an anonymous function. "        

If you are not confortable using arrayfun, just do

for ii = 1:numel (xx) 
 dd(ii) = getz(xx(ii));
endfor

As for the error:

> error: 'input1' undefined near line 30 column 8
> error: called from:
> error:   C:\Octave\Octave-3.8.1\TUNNELING\getz.m at line 30, column 5
> error: evaluating argument list element number 1
> error:   C:\Octave\Octave-3.8.1\TUNNELING\tunnelallignment.m at line 38,
> column 3

This is expected because you are invoking 'getz' with no input arguments
and getz has a check to avoid this.


> z=-(vloss/(sqrt(2*pi)*k* getz(dd))).* exp(-yy.^2/(2* (k*getz(dd)).^2));

This line looks very confusing to me ...
why would you use 'getz(dd)' in this line if you have already evaluated

dd(ii) = getz (xx(ii))

HTH,
c.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]