How can I use the brush tool after compile my app in appdesigner?

10 views (last 30 days)
When I run my app in MATLAB platform, everything is ok, but when I compile the app, the brush tool doesn´t work. I am using R2022a. So I need to know how to use this tool in an .exe for the UIAxes, because I need to select some points on the app. Regards.

Answers (1)

Cameron
Cameron on 29 Dec 2022
Edited: Cameron on 1 Jan 2023
Can you clarify your question a bit more? What are you trying to do, and what is your app doing instead of allowing you to brush your data?
I have had a similar issue, but I can't tell if it's the same as yours from your description. I got around my problem by clicking the brush button, moving my cursor over the UIAxes momentarily, moving the cursor back over the axtoolbar area (where your brush tool is located), and then being able to brush my data.
  3 Comments
Edwin Henry Jara Bardales
Edwin Henry Jara Bardales on 31 Dec 2022
Edited: Edwin Henry Jara Bardales on 31 Dec 2022
@Cameron, in addition:
When I call the subprogram, I ensure (in the main program) that brush data tool is activated using:
Apoyos; % This line calls the subprogram which has the title: 'ASIGNAR RESTRICCIÓN EN NODO'
brush(app.UIAxes_modelofinal,'on') % This line is to activate the brush data tool.
What am I doing wrong? or what Can I do to correct that problem when i Compile in order to get the .exe program?
Cameron
Cameron on 1 Jan 2023
Seems like there are two issues. The first (and hopefully easiest) is how to keep the brush data tool visible in the axis toolbar. I think you can just run the code below to ensure the brush tool is available.
Apoyos;
axtoolbar(app.UIAxes_modelofinal,{'brush','pan','restoreview'});
brush(app.UIAxes_modelofinal,'on')
The the only time I've seen the brush tool disappear is when you try to add the brush but don't plot any data like this:
ax = uiaxes;
axtoolbar(ax,{'brush','pan','restoreview'});
I also noticed that if you try to force the brush tool to be active when there's no data in the plot, it can do some strange things. For example, if you run this:
ax = uiaxes;
axtoolbar(ax,{'brush','pan','restoreview'});
brush(ax,'on')
then the brush tool will be active. But once you click the brush again to disable the function, it will disappear because there is no data in the uiaxes.
The second part of your issue is a bit stranger. So your code runs fine within App Designer, but once you compile your program into an executable, you're unable to select any points because the cursor doesn't turn into the crosshair, right? I'll try to replicate it on my end but I need to know which version of MATLAB you're using first. Did you try my workaround where you click the brush tool to turn it on (or I guess in your case do it programatically), then move your cursor over the uiaxes, then move it back over the brush tool and then try to select your points? This has worked when I've had the issue where my cursor doesn't change from a pointer to crosshair.

Sign in to comment.

Categories

Find more on App Building 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!