<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Le 20/01/2020 à 09:18, Federico Miyara
      a écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:d6862b3d-9a45-422e-813f-623665cee7ef@fceia.unr.edu.ar">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <br>
      <font face="Courier New">Dear All,<br>
        <br>
        I have an N-D array A (sometimes called hyperarray) with n
        dimensions, where n is a parameter a priori unknown since it is,
        for instance, an input argument of a function. So in conceptual
        form each element is<br>
        <br>
        A(k1, k2, k3, ..., kn)<br>
        <br>
        I'm looking for an elegant way to extract all elements with a
        given index over a given dimension, for instance<br>
        <br>
        A(:, k2, :, ..., :)<br>
        <br>
        This would mean to get an hyperarray made up of the k2-th column
        of all remaining dimensions.<br>
        <br>
        If extraction could be performed replacing the indexes by a
        list, for instance<br>
        <br>
        L = list(),<br>
        for i=1:n<br>
           L($+1) = 1:size(A)(i);<br>
        end <br>
        L(2) = 1<br>
        <br>
        Then A(L) would work, but the result is an error message
        "Invalid index".<br>
      </font></blockquote>
    <p><br>
    </p>
    <p><font face="Courier New">A(L(:)) should do it.</font></p>
    <br>
  </body>
</html>