bugGNU Octave - Bugs: bug #33982, Use of tilde (~) operator to...

 
 

bug #33982: Use of tilde (~) operator to ignore outputs is not supported

Submitter:  -Deleted Account- <gbhrt>
Submitted:  Thu 11 Aug 2011 08:00:47 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 3.4.2 Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 11 Aug 2011 09:23:17 PM UTC, comment #3: 

Sorry to have frustrated you, but we're having distribution problems with Windows. We need help. Can you help? If Octave isn't working for you, perhaps you can help us improve it. Compiling on Windows is painful and complicated and few people want to help us do it.

However, some people have. Tatsuro Matsuoka has created some Octave 3.4.2 packages for Windows that may work for you, but are possibly still a little rough around the edges:

http://www.tatsuromatsuoka.com/octave/Eng/Win/

Also, bear in mind that Matlab compatibility is a moving target, since new versions of Matlab also frequently introduce new features, so we also need help catching up to it.

Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Thu 11 Aug 2011 08:10:07 PM UTC, comment #2: 

If fixed, then update all OS versions. As youc an see I reported the windows version.

The usuage is hardly only limited to my example as you probably understand if you think for a while.

Thank you anyway, so far I havent seen the compaitbility you talk about, just about every sample I try there are differences from matlab.


-Deleted Account- <gbhrt>
Thu 11 Aug 2011 12:37:32 PM UTC, comment #1: 

This feature was added in Octave 3.4.x.  You marked that as the version in the bug report form, but your example shows that you are using Octave 3.2.4.  I'm closing this report since the feature is already implemented in the current Octave release.

Also, there is rarely a need to ignore trailing output arguments unless your function does something different based on nargout.  In the specific case you show, you might as well simply write


a = example (1, 2);


since the effect is the same.

OTOH, it is often more useful to write things like


[~, b] = example (1, 2);


since then the unneeded output is not stored in the scope of the function call even if it is computed by the function.

John W. Eaton <jwe>
Group administrator
Thu 11 Aug 2011 08:00:47 AM UTC, original submission:  

In matlab, inputs or outputs can be selectively ignored using the tilde ~ operator, Octave seem to think the use of ~ in these cases is a syntax error.

Example:

function [a, b] = example(a,b)
a = a +b;
b = a - b;
end

octave-3.2.4.exe:5> [a, ~] = example(1,2)
parse error:

  syntax error

>>> [a, ~] = example(1,2)

          ^

Matlab documentation on the subject:
http://www.mathworks.com/help/techdoc/matlab_prog/bresuxt-1.html#br67dkp-1



-Deleted Account- <gbhrt>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jordigh (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-08-11 jwe Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code