octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #48471] Ans output lost with redirection


From: anonymous
Subject: [Octave-bug-tracker] [bug #48471] Ans output lost with redirection
Date: Mon, 11 Jul 2016 16:41:56 +0000 (UTC)
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?48471>

                 Summary: Ans output lost with redirection
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Mon 11 Jul 2016 04:41:53 PM UTC
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: Joel
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.0.2
        Operating System: Any

    _______________________________________________________

Details:

When I try to redirect a function evaluation with an "ans" output, it appears
to get lost for Octave (but not MATLAB). Here is an illustration:

% bar.m
function v = bar()
   v = 42;
end

% baz.m
function varargout = baz()
   for i=1:max(1,nargout) % always ans
     varargout{i} = 42;
   end
end

% foo.m
function varargout = foo(c)
   if c
     [varargout{1:nargout}] = bar();
   else
     [varargout{1:nargout}] = baz();
   end
end

Test script with results for MATLAB and Octave
% test_foo.m
bar % ans=42 in both MATLAB and Octave
baz % ans=42 in both MATLAB and Octave
a = foo(true);
foo(true);
foo(true) % ans=42 in MATLAB, nothing in Octave

a = foo(false);
foo(false);
foo(false) % ans=42 in MATLAB, nothing in Octave
[a,b] = foo(false);




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?48471>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]