using self created class in gui
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
hi, im trying to understand the the oop concept in matlab. i got some classes
classdef myclass
...
end
without gui i could write
blabla = myclass
but i want to create an instance of a class when a button is clicked. so in that case i dont have a name for that instance or object. how is that generally done in matlab
thanx a lot
0 Kommentare
Antworten (2)
Sean de Wolski
am 9 Mär. 2012
Well, what do you want to name it? And what do you want to do with it after? You could have an edit box in the gui qwhere the user puts in the name they want to call it. etc. This is a hard question to answer without more detail.
Walter Roberson
am 9 Mär. 2012
You would still write
blabla = myclass
in your callback of the button. That will create the instance within the workspace of the callback function.
The problem then shifts to how you avoid having the instance destroyed when the callback function returns. The answers to that are much like if it was a numeric value you had computed: store the object somewhere that will continue to exist once the callback function returns.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Data Type Identification finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!