MATLAB: Is it okay the way you saved one function in a guide and then I use it in another

guide

I asked for it in a guide
p=inline(get(handles.edit1,'string'))
setappdata (0, 'string', p)
and to use it in another guide towards this
p = getappdata (0, 'string')
f=p