bugGNU Octave - Bugs: bug #48471, Ans output lost with redirection

 
 

bug #48471: Ans output lost with redirection

Submitted by:  None
Submitted on:  Mon 11 Jul 2016 04:41:53 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: JoelOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 4.0.2
Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 11 Jul 2016 06:32:31 PM UTC, comment #1:

Thank you for your detailed bug report. Thankfully, this has been fixed in the default branch of Octave and should work correctly for you with Octave 4.2.

Mike Miller <mtmiller>
Project Administrator
Mon 11 Jul 2016 04:41:53 PM UTC, original submission:

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);

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 11 Jul 2016 06:32:31 PM UTCmtmillerStatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1