Do NOT use global variables. Use the handles
structure to pass this data.
In q7_OpeningFcn
, store this data (e.g. handles.rows=...
).
In the callbacks, you will have the data in the handles
struct.
If you change values in handles
in your callbacks, you need to run guidata(hObject,handles)
. See Store Data Using the guidata
Function and the example there.
You can also use setappdata
/getappdata
to store and retrieve data by name ("application data"). See the article Share Data Among Callbacks for details on both approaches.