By MATLAB window you mean Figure don't you?
What you want to do is a GUI, that can be done using GUIDE or by doing all the code in one m-file, considering your basic question I assume you don't have much experience with MATLAB, try using GUIDE and get the best examples 41 Complete GUI Examples by Matt Fig