On 21 Oct 2010, at 10:05, JuanPi wrote:

> Dear all,
>
> I have been trying to documet my functions with some examples. I am
> using the format described in
>> help demo
>
> I have a function point2triag that works perfectly when I call it form
> Octave's terminal, but when I use
>> demo(point2triag)
> I am getting an error of undefined elements in the body of the  
> function.
>
> The header is
> %% p2T = point2triag(T)
> % p2T = point2triag(T,degMax)
> %
> % Given a triangulation T produces the matrix that indicates for  
> each point to
> % which triangles it belongs to.
> % The tinagulation T is matrix fo size Ntx3 where each element is an  
> integer
> % indicating the position of a node in a list of vertices.
> % Since different points can belong to a differnt number of  
> triangles, the
> % output has NaNs as unused elements.
> %
> % The optional argument degMax indicates the maximum number of  
> trinagles a point
> % can belong to. If your mesh has a point belonging to more than 10  
> trinagles
> % you should use degMax > 10 (default value).
> %
> %!demo
> %! coord=rand(10,2);
> %! Tri=delaunay(coord(:,1),coord(:,2));
> %! p2T = point2triag(Tri)
>
> The last 3 lines defines the demo. They work perfectly in the terminal
> I am using Octave 3.2.4 compiled in Ubuntu 10.04
>
> Thanks
> -- 
> JuanPi Carbajal

JuanPi,
If you are working a lot with triangular meshes you might want to take  
a look at the package msh in octave forge:

http://octave.sourceforge.net/msh/index.html

For example, it would be nice to add the functionality of your  
function 'point2triag' to the function:

http://octave.sourceforge.net/msh/function/msh2m_topological_properties.html

just one question, why are you using a matrix full of NaNs and not a  
cell-array to store p2T?
I think using p2T would make it very easy to write a vectorised  
version of 'point2triag'...

c.






------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to