Storing arrays with guidata/Userdata
Mostrar comentarios más antiguos
Im having a hard time wrapping my head around how I might go around storing an array for later use using my gui. I want to be able to store an array called LN using a pushbutton but im not entirely sure how to tackle it. I dont need anything too complex I just want to be able to see an example and figure out where to start. Ive looked over guidata and Userdata functions. I came to the conclusion guidata may be more functional for my current project, but other than using it within a figure, im not sure how to store LN with the press of the pushbuttons I have.
5 comentarios
Walter Roberson
el 14 de Nov. de 2023
Are you using App Designer or GUIDE or building your own code?
Mason
el 14 de Nov. de 2023
Stephen23
el 14 de Nov. de 2023
If you are writing your own GUI then by using nested functions you can easily avoid this whole GUIDE-based indirection of using GUIDATA.
Mason
el 14 de Nov. de 2023
Mason
el 14 de Nov. de 2023
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 14 de Nov. de 2023
function Myproj_Button1_Callback(hObject, event, ~)
handles = guidata(hObject) ;
handles.LN = magic(7);
guidata(hObject, handles);
function Myproj_GoButton(hObject, event, ~)
handles = guidata(hObject);
LN = handles.LN;
If you are using guide then some simplifications are possible
Categorías
Más información sobre Whos en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!