As far as I can tell from this documentation on signatures, the second slot is for an object that will receive the output. I suppose that, if you pass in a length-3 array (or whatever output object is appropriate), then it'll get the elements you want; whereas, if you pass in the constant 3 as the second argument, it tries to stuff the output into that constant, with results that are presumably nonsensical at best.

As ikegami mentioned, this function doesn't seem to exist in the latest version of PDL (see particularly PDL::Primitive). Unless you're stuck with an older version, or have a reason to prefer it, then it's probably a good idea to work with the latest one. (Also, it might be a good idea to put something more prominent about PDL in your main post, so that future readers don't have to dig down several levels in the comments to find out what we're discussing.)


In reply to Re: maximum_n_ind example by JadeNB
in thread PDL Command: maximum_n_ind example by Blue_eyed_son

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.