Modified Hungarian Notation for Matlab (Version 1.1) BE-205, Winter 2011-12, Dr

Modified Hungarian Notation for Matlab (Version 1.1) BE-205, Winter 2011-12, Dr

Modified Hungarian Notation for Matlab (Version 1.1) BE-205, Winter 2011-12, Dr. C. S. Tritt Unlike must modern languages Matlab is not “strongly typed.” Strongly typed languages require all variables be explicitly declared prior to use. Compilers keep track variable types and generate compile time errors when a variable is used incorrectly. Matlab allows (and encourages) variable to be created and used “on the fly.” In simple programs, this reduces unnecessary formality. However, in larger programs it can sometimes result in confusion between to variables having similar names (either intentionally or due to typographical errors). One way to avoid the unintentional misuse of variables is to use what is known as “Hungarian” notation. In Hungarian notation, information about the type (class) of a variable is encoded in its name. This allows programmers to quick identify or recall how a variable should be used. While it would be excessive to use Hungarian in every case, its use can make medium to large programs easier to create, understand and maintain. These are not strict rules, just suggestions to make programs easier to follow. Case rv – Row vector m – Matrix initial l.c. – Ordinary variables and functions p – Pointer Initial Cap – Structure, Class or Property h – Handle ALL CAPS – Constants (Matlab doesn't str – Structure enforce constancy) cstr - cellstr Special Variables for particular uses Postfixes m and n – Matrix indexes. Str – String Prefixes Text – Static text control Edit – Edit control i – Integer (never use alone) Button – Push button control d – double Box – Check box control b – Logical or Boolean Radio – Radio button control Toggle – Toggle button control s – Scalar Group – Button group panel. v – Vector Panel – A panel cv – Column vector Examples MAX_SIZE – A constant representing the maximum size of something. dMeanValue – A double. strPatient.FirstName – The patient’s first name (a property in a structure). redRadio – A radio button that specifies something being red. .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    1 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us