I assume you are using MATLAB App Designer. You can define helper functions, which can be used by other functions inside or outside your app. There are two types of helper functions: private functions, which you can call only inside your app, and public functions, which you can call either inside or outside your app. Private functions are commonly used in single-window apps, while public functions are commonly used in multiwindow apps.
See detail steps to create helper functions here.