MATLAB: Help: Display a different layout when pushing a button in a GUI

swich layout in gui

Hi all,
I'm trying to write a programmatic GUI. It includes a push button and a edit text named "tab1" when it initializes. Then when I hit the button the edit text "tab1" will be hidden and the GUI will show the edit text "tab2" which was invisible before hitting the button. I also attached my code which doesn't work.
Any help would be greatly appreciated.
Thanks.

Best Answer

The reason your code doesn;t work - is that when the callback for the pushbutton is created the variable S.tab1 doesn't exist. If you moved the pushbutton creation to the end then it would work.
It looks like you are trying to build a GUI with tabs?
If you looking for an off the shelf solution look here
A good place to start to learn about GUIs is to use this FEX submission