<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix"><font color="#009900">Hello Shamika,<br>
        <br>
        When we call a function defined with several output variables
        (either with a list of named argout, or with varargout),<br>
        a simple call like <font size="2"><span
            style="font-family:monospace,monospace">callOctave(<wbr>fname,varargin)</span></font><big><font
            size="2"><big> with no explicit assignment always returns
              only the first argout. To get next argout, they must be
              explicitly assigned like in: </big></font></big><br>
        <font size="2"><span style="font-family:monospace,monospace"><font
              size="2"><span style="font-family:monospace,monospace">[a,b,c]
                = callOctave(<wbr>fname,varargin)</span></font></span></font></font><big><font
          size="2"><big><font size="2"><big><font color="#009900">  <br>
                </font><br>
              </big></font></big></font></big><font size="2"><span
          style="font-family:monospace,monospace"><font size="2"><span
              style="font-family:monospace,monospace"><br>
            </span></font></span></font>Le 08/11/2016 06:47, Shamika
      Mohanan a écrit :<br>
    </div>
    <blockquote
cite="mid:CAHbxmFRr0bw7urTDn0CHa-CoA4aJCQOw6kSgPzhGkZ6cQ+TfbA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>
                <div>
                  <div>
                    <div>
                      <div><font size="2">Hello,<br>
                          <br>
                        </font></div>
                      <font size="2">I have a function defined as such<br>
                        <br>
                        <span style="font-family:monospace,monospace">function
                          varargout= callOct(fname,varargin)<br>
                              varargout=list(callOctave(<wbr>fname,varargin))<br>
                          endfunction </span><br>
                        <br>
                      </font></div>
                    <font size="2">When I call this function with <span
                        style="font-family:monospace,monospace">[c,d]=callOct("butter",8,0.1)</span>,
                      I get the error <br>
                      <span style="font-family:monospace,monospace">!--error
                        21 <br>
                        Invalid index.</span><br>
                    </font></div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <font size="2">I<font color="#009900">t's normal: </font></font><font
      size="2" color="#009900"><span
        style="font-family:monospace,monospace">callOctave(<wbr>fname,varargin)
        returns only its first argout. So list(callOctave(...)) has only
        one component and varargout is limited to this one, while with</span></font><font
      color="#009900"><br>
      <font size="2"> <span style="font-family:monospace,monospace">[c,d]=callOct("butter",8,0.1)<br>
          you try to get in d a second argout -- that does not exist:
          => error<br>
        </span></font></font>
    <blockquote
cite="mid:CAHbxmFRr0bw7urTDn0CHa-CoA4aJCQOw6kSgPzhGkZ6cQ+TfbA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>
                <div>
                  <div><font size="2"><br>
                    </font></div>
                  <div><font size="2">If I call the function as </font><font
                      size="2"><span
                        style="font-family:monospace,monospace">c=callOct("butter",8,0.1),</span><span
                        style="font-family:arial,helvetica,sans-serif">
                        I get no error.</span><span
                        style="font-family:monospace,monospace">
                        varargout </span><span
                        style="font-family:arial,helvetica,sans-serif">stores
                        only one o/p argument even though callOctave
                        returns two arguments.<br>
                        <br>
                      </span></font></div>
                  <font size="2">If I remove <span
                      style="font-family:monospace,monospace">varargout</span>
                    like this<br>
                    <br>
                    <span style="font-family:monospace,monospace">function 
                      [b,a]=callOct(fname,varargin)<br>
                          [b,a]=callOctave(fname,<wbr>varargin)<br>
                    </span></font></div>
                <font size="2"><span
                    style="font-family:monospace,monospace">endfunction</span><br>
                  <br>
                </font></div>
              <font size="2">Now when I call this function with <span
                  style="font-family:monospace,monospace">[c,d]=callOct("butter",8,0.1)</span>,
                I get no error. <br>
                <br>
              </font></div>
            <font size="2">I need callOct function to work with any
              number of output arguments and so I need to use varargout.
              How do I get the function to work with varargout?<br>
            </font></div>
        </div>
      </div>
    </blockquote>
    <font size="2">.<br>
      <font color="#009900"><big>To answer, you must provide information
          about how you define  </big></font></font><font
      color="#009900"><big><font size="2"><big><span
              style="font-family:monospace,monospace">callOctave(<wbr>fname,varargin):<br>
            </span></big></font><font size="2"><big>Does it use also
            varargout, or not?<br>
            <br>
            Regards<br>
            Samuel Gougeon<br>
          </big></font></big></font><br>
  </body>
</html>