Problem with get matrix from one function buton to second.

1 view (last 30 days)
Hello, i have a problem with get a matrix data which i created in one pushbutton. I need it in other pushbutton, but i dont know how corectly set "set" and "get" for cell...;/
i have cell in function pushbutton15_Callback name: tablicaRandLearnFull, value:70x5 double, and i need it in function pushbutton6_Callback,
if (handles.checkbox3.Value == 1.0)
P=[tablicaRandLearnFull(:,3)]
end
i get this error: "Undefined function or variable 'tablicaRandLearnFull'.",
when i put tablicaRandLearnFull(:,3) in command window i get data normally... Could u help me?

Accepted Answer

Bhargavi Maganuru
Bhargavi Maganuru on 13 Sep 2019
You can access variables in another callbacks by saving the variables to handles structure, which is usually input to all callbacks.
To save tablicaRandLearnFull variable to handles, use
handles.tablicaRandLearnFull = tablicaRandLearnFull;
guidata(hObject, handles); %to update handles
Access handles in another callback using the following command
handles.tablicaRandLearnFull
Hope this helps!

More Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!