Quick, delete the line with global variable before MATLAB police comes! Don't use global variables, unless there is really a need for it.
First of all, if you will use your variables in external functions, use the as properties, there is an option called Create property - public and define it.
Similarly for char array: Type ='';
You can access or change the property value by typing
In App designer create a button and a callback. Within it call your external function and pass the whole app (or only needed variables)
And within the external function access the variables/properties as mentioned above.