Handle to a Property or field
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Nathan Bblanc
el 14 de Mzo. de 2023
Comentada: Nathan Bblanc
el 18 de Mzo. de 2023
Lets say I have a struct or a handle object with many properties, so that calling a property with a dot is time consuming (it is done millions of times ever run)
is there a way to asign a handle to the property so that I can call it directly?
Nathan
0 comentarios
Respuesta aceptada
Rik
el 14 de Mzo. de 2023
The only way I can think of is to make that property contain an object of a handle class. Other than that, no, because you can only directly refer to objects, not to their properties.
If the indexing is the problem, why not store the value in a variable? I can't imagine any user interaction generating changes millions of times.
4 comentarios
Rik
el 16 de Mzo. de 2023
Editada: Rik
el 16 de Mzo. de 2023
Perhaps a persistent variable to create a makeshift dictionary would do the trick?
That way you can use ismember to look up the index in your cached data. You can even implement a counter that refreshes your data every X times.
Also, what do you think the chances are that I made a typo in my own name?
Más respuestas (0)
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!