Matlab app designer brush function ActionPostCallback

27 vues (au cours des 30 derniers jours)
Sankar Mahadevan
Sankar Mahadevan le 24 Jan 2023
Commenté : Adam Danz le 25 Jan 2023
I have 20 different UIaxes in my Matlab app
Now the user can choose to apply brush function to filter some data. This can be done in any of the 20 Uiaxes (Uiaxes 1 to 20) that I have.
After the brush button is pressed and data is removed/exported, I want to have a Actionpostcallback, which will link the filtered data to a variable in the app.
How do I add a postcallback function to the brush tool in app designer? Anytime I press the brush button, I cant access the brush function in app designer to add a callback
  1 commentaire
Adam Danz
Adam Danz le 25 Jan 2023
A while ago I showed users how to hijack the axes toolbar's Restore button so users can defined their own function in addition to the default restore function (this answer). It would be easy to switch this example to use the brush button instead however, it wouldn't be useful. The brush button has a ValueChangedFcn that is called any time the brush button is pressed (on or off). But the botton is pressed either before or after the point selection interactions so a function that responds to the toolbar button press wouldn't be useful.
An alternative to the brush tool is to use rbbox which is similar to the brush tool but returns the rectangle coordinates which can be used to compute which points were selected (e.g. inpolygon). However, because uifigure handlevisibility is off by default and because rbbox doesn't have the option to specify an axes, you must implement a workaround to use rbbox with axes in AppDesigner. The easiest of the two workarounds is to turn the app figure's HandleVisibility to On and to make sure the app's axes are the current axes prior to calling rbbox. Alternatively, follow this demo to uses a rectangular region tool from the Image Processing Toolbox that is programmed to behave as a rbbox.
Lastly, another idea is to create your own axes toolbar button that implements your preferred workaround.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Language Fundamentals dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by