Here is a list of all the useful tips in matlab

Defining/Accessing structures

  % simple structure is defined as
  vector.x=12;    vector.y=23;    vector.z=56;    
  
  % accessing values (method 1)
  vector.x
  
  % accessing values (method 2)
  SelField= y;
  vector.(SelField) = 12

Useful functions

Classes and OOP

A complex class is defined as

  defclass CLASSNAME
    properties 
       % No restriction on following var access/modified  (within/outside class)
       a1; b1;  c1 ;    
    end
    
    properties (setaccess=private,getaccess=public)
       % These variable's value can be accessed by anyone but can't be modified outside the class.
       a2; b2;c2       
    end
    
    properties (setaccess=private,getaccess=private,hidden)
      % These variable's value can be accessed/modified within the class only
      a2; b2;c2
    end
    
    properties (dependent)
       % these variables values is not stored and these are computed only during access, 
       % i.e. these depend upon the state of other variables. 
       a3;   b3;   c3    
    end
    
    methods             
          % This function is used for instantiating the class, i.e. when class is called for first time . 
          % Its name must be same as the class name. These function are called as  
          % P=CLASSNAME(IPARG1,IPARG2,...)            
          
          function obj = CLASSNAME(IPARG1,IPARG2,...)                  
              obj.a1 = 43;
              obj.a2 = 36;
              ...
          end
          
          % Other methods/functions associated with this class can also be defined.
          % These function are called as              
          % P=CLASSNAME.CLASSFUN(IPARG1,IPARG2,...)
           
          function obj = CLASSFUN(IPARG1,IPARG2,...)    % used for instantiating the class
              obj.a1 = 43;
              obj.a2 = 36;
              ...
          end
    end
    
    methods (Static)    
        % Static fun can be called independelty as CLASSNAME.FUNNAME(IPARG1,IPARG2,...)
        
        % Method 1: explicitly define static function
        function OPARG = FUNNAME(IPARG1,IPARG2,...)
           .....  
        end
        
        % Method 2: placing the function in separate file in same class folder i.e. @CLASSNAME
        % and defining an interface here
        OPARG = FUNNAME5(IPARG1,IPARG2,...)    
    end
  end