<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <br>
    <font face="Courier New">Samuel,<br>
      <br>
      Thanks VERY much!<br>
      <br>
      It certainly does the job, but I don't quite understand how. For
      example, to retrieve the last columns of all dimensions: <br>
      <br>
      <br>
      A = matrix(1:120, </font><font face="Courier New">[5,4,2 3]</font><font
      face="Courier New">);<br>
          <br>
      L = list();<br>
      for i=1:length(size(A))<br>
          L($+1) = 1:size(A)(i);<br>
      end<br>
      <br>
      L(2) = size(A)(2);<br>
          <br>
      B = A(L(:));<br>
      <br>
      <br>
      B is exactly the desiredresult. But when I try to see what is L(:)
      I get<br>
      <br>
      --> L(:)<br>
       ans  =<br>
      <br>
         1.   2.   3.   4.   5.<br>
      <br>
      and <br>
      <br>
      --> A(ans)<br>
       ans  =<br>
      <br>
         1.<br>
         2.<br>
         3.<br>
         4.<br>
         5.<br>
      <br>
      If I try to assign L(:) to a variable I get<br>
      <br>
      --> u=L(:)<br>
      <br>
      Can not assign multiple value in a single variable<br>
      <br>
      So I attempt<br>
      <br>
      --> [u1,u2,u3,u4] = L(:)<br>
      <br>
      and get<br>
      <br>
      <br>
       u4  = <br>
      <br>
         1.   2.   3.<br>
       u3  = <br>
      <br>
         1.   2.<br>
       u2  = <br>
      <br>
         4.<br>
       u1  = <br>
      <br>
         1.   2.   3.   4.   5.<br>
      <br>
      However disp(L(:)) yields<br>
      <br>
         1.   2.   3.<br>
      <br>
         1.   2.<br>
      <br>
         4.<br>
      <br>
         1.   2.   3.   4.   5.<br>
      <br>
      <br>
      I would like to understand what's going on.<br>
      <br>
      Regards,<br>
      <br>
      Federico Miyara<br>
      <br>
      <br>
    </font><br>
    <div class="moz-cite-prefix">On 20/01/2020 05:29, Samuel Gougeon
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:6415a21f-eafa-52a1-d5ea-73707299df33@free.fr">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <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>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>