MATLAB: Convert global to local co-ordinate system

MATLABminidronecompetitionsimulinkstateflow

I want to move the drone with reference to its local co-ordinate system, however the XYZ inputs are with respect to the global co-ordinate system. How can I convert the global co-ordinate reference to the local co-ordinate reference?