home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / softsys / matlab / 194 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  1.7 KB

  1. Path: sparky!uunet!ulowell!m2c!nic.umass.edu!noc.near.net!MathWorks.Com!nuntius
  2. From: little@mathworks.com (John Little)
  3. Newsgroups: comp.soft-sys.matlab
  4. Subject: Re: Parser bugs
  5. Message-ID: <C1HIAv.6EE@MathWorks.COM>
  6. Date: 26 Jan 93 23:23:18 GMT
  7. References: <1993Jan22.215229.14108@MathWorks.COM>
  8. Sender: news@MathWorks.COM (Usenet News Account)
  9. Organization: The MathWorks, Inc.
  10. Lines: 49
  11. X-Useragent: Nuntius v1.1
  12.  
  13. In article <1993Jan18.155531.4025@tdb.uu.se> Peter Haegglund,
  14. peterh@tdb.uu.se writes:
  15. >: Hi,
  16. >:     Just curious whether a couple of parser bugs/quirks have been fixed
  17. >: in version 4.0.  Two such quirks that come to mind are:
  18. >: 
  19. >: 1)
  20. >: >> 4 * -1    % this will result in an error
  21. >: >> 4 * (-1)    % this will work
  22. >: 
  23. >: 2)
  24. >: >> [1 + 2 * 3, 4]    % how many elements in this matrix?
  25. >: 
  26. >: This handling of unary operators is just a little unintuitive --
  27. usually
  28. >: mere nuisance value.
  29.  
  30. The first of these "quirks" is a reasonable suggestion and I'll see that
  31. it is added to our "wish list" for possible inclusion into a future
  32. version of MATLAB.
  33.  
  34. The second of these two "quirks" has been "improved". As several other
  35. people point out, spaces are significant inside brackets.  This is
  36. a "nice" feature in that it allows statements like
  37.  
  38.    a = [a b; c d]
  39.    a = [1 2 3 4 5 6]
  40.  
  41. rather than requiring commas between matrix elements. However using 
  42. MATLAB 3.5 the statement
  43.  
  44.    a = [1 + 2 * 3, 4]
  45.    
  46. gives you
  47.  
  48.    a = 1  6  4
  49.  
  50. because the "+" is treated as the sign on the 2. Using MATLAB 4.0 this 
  51. now returns an answer that is more likely to be what you intended:
  52.    
  53.  
  54.    a  =  7   4
  55.    
  56. We noticed too that if there are spaces around the operator then it
  57. is unambiguous what you want.
  58.  
  59.  
  60. John Little
  61. little@mathworks.com
  62.