App Designer Capabilities - it is nerve-wrecking!

Hi!
I am exploring the app-designer instead of GUI. I want to use the app-designer just because it looks nicer, but I am having difficulty figuring out its capacilities. It is getting really nerve-wrecking actually b/c it is hard to find examples on app designer, even something little takes long time to figure out. I have quick questions I will list below. In an app that is compiled as a standalone:
  1. Can I add "print" to the menubar, the generic "print" we have on a typical guide?
  2. Can I add, save, saveas,... to menubar, in this save it d save whatever is seen on the app's current screen including all components?
  3. Can I manipuate a table to have move-up and move-down buttons?
  4. Can I have pan, rotate, etc. for a figure?
I think all of those are doable using "Guide", I wonder if they are doable in the app-designer? I appreciate if you guys could answer those questions!

 Accepted Answer

1) "Can I add print to the menubar?
You can add anything you want to the menubar. From the AppDesigner interface, drag and drop the Menu Bar from the Figure Tool section to your GUI. Add a new menu item and rename the new "Menu" to "Print". Then in the MenuSelectionFcn() callback function, you can assign any subroutine you'd like. However, print() is not supported for UIFigures (bummer) so I'm not sure what you intend to print. You can always use a 3rd party screen shot program.
2) "Can I add, save, saveas...."
Similar to my comment above, save(), saveas() and savefig() are not supported for UIFigure (double bummer).
[UPDATE]
If you're working with GUIDE or a GUI developed from uicontrol(), you can add a button, name it "save", and in its callback function, you can save an image of the GUI like this.
saveas(handles.MyGUI, 'MyGUIsnapshot', 'png')
% * 'MyGui' is the handle to your GUI figure.
% * I don't recommend saving it as 'fig' since you'll end up with
% multiple GUIs instead of an image of your GUI.
3) "Can I manipuate a table to have move-up and move-down buttons? "
The tables in appdesigner already have those features.
4) "Can I have pan, rotate, etc. for a figure?"
Yes! For UI axes, both rotate3d() and pan() only support the on and off arguments.
pan(app.UIAxes, 'on')
rotate3d(app.UIAxes, 'on')

11 Comments

Baha411
Baha411 on 2 Aug 2019
Edited: Baha411 on 2 Aug 2019
Thanks for your answer.
1) I use "printer" button on the toolbar of a GUI and it prints whatever is on the screen with no problem. Is that weird? I usually create axes on the entire interface of the GUI though (and make axis ticks invisible then populate gui components on it - that way I could use latex format on texts), not sure if that is helpful to print everthing on the gui when using printer button.
Yeah it sucks that print, save, saveas... don't work, then.
3) Ohh my bad, I meant to say if I can move a row up and down. Just need to update the "app.UITable.Data" when I click a button, I am 99% sure it is doable in the app designer.
"1) I use "printer" button on the toolbar of a GUI and it prints whatever is on the screen with no problem. Is that weird?"
Is the GUI made in appdesigner? Guide? If that GUI is made in appdesigner I'd like to know how you did that.
"3) Ohh my bad, I meant to say if I can move a row up and down. Just need to update the "app.UITable.Data" when I click a button, I am 99% sure it is doable in the app designer."
Yes, this is straightforward. Just add an 'up' and 'down' button to your GUI. In their callback functions you'll just need to grab the UITable data, identify the row selected, rearrange the data, and then reassign the updated data to the UITable.
Baha411
Baha411 on 2 Aug 2019
Edited: Baha411 on 2 Aug 2019
Oh no GUI made in guide lol. You have any solution for that, something similar to print button?
Yeah makes sense.
Yes, see the update in my answer.
Well I am confused! I am using app-designer now. Can I use this code below in the app-designer?
saveas(handles.MyGUI, 'MyGUIsnapshot', 'png')
I used guide before and print button was working there. Now I am working on app-designer and my questions is on how to screenshot on the app-designer.
I interpreted your previous comment as "Oh no, GUI made in guide" as if your GUI was made in guide. But the comma should have been at "Oh, no GUI made in guide". Interesting how a comma placement changes the meaning of the ambiguous phrase (enter cognitive science experiment).
The solution would only work with guide or uicontrol GUIs. As I mentioned before, with app designer you'll have to use a 3rd party screen shot program since the save, saveas, etc functions do not work with those figures. Maybe there's something on the file exachange.
Baha411
Baha411 on 2 Aug 2019
Edited: Baha411 on 3 Aug 2019
Haha thanks for checking my grammar, I wasn't paying much attention to it lol, my bad ;p
Yeah I meant I can use the print button in the Guide GUI, but why can't I use it in the app designer. It is super convenient to use to the printer button, rather than going and screen capturing (e.g., snipping tool), and printing there. And the resolution of using a such tool is not as good as directly printing with print button. Matlab should enable the print button and other toolbar options for app designer. Now I am in the middle of a dilemma either going back to Guide or staying with the app-designer. One is not superior than another; both has goods and bads!
Thanks you! Your answers were helpful.
I agree, that is a convenient feature and I'm not sure why it isn't implemented in AppDesigner.
Baha411
Baha411 on 3 Aug 2019
Edited: Baha411 on 3 Aug 2019
Adam, a few more questions....
Do you know if there is a way to use the latex format within a table cell or editable text field in app-designer? If not I d need to go back to the method I used in guide (creating axis and patching text onto it with latex format).
And is there a way to make table values to be centered in app-designer? It was so painful to do that in guide, I hope they enabled it for appdesigner.
"Do you know if there is a way to use the latex format within a table cell or editable text field in app-designer?"
I'd have to do some googling. Maybe this?
" is there a way to make table values to be centered in app-designer?"
Check out the rabbitt hole (the 2 links in Walter's answer below).
While we're at it, here's a list of all properties you can change in a UItable
Thanks for your reply! I was using those tricks in guide for centered text and the code was getting really messy when I created delete-row, add-row, up-row, down-row buttons and when there is categorical column etc for multiple tables in multiple tabs. I was hoping if it was a direct option in the app-designer, but looks not.

Sign in to comment.

More Answers (1)

It is absolutely incredible that Mathworks, after all these years, still hasn't found a decent way to create advanced GUIs.
Now, they are forcing everyone to migrate from GUIDE to App Designer, which sucks even more and imposes even more limitations. The App Designer developers seem to do everything to make GUI development with Matlab an even bigger pain in the bottom than it was with GUIDE.

7 Comments

I agree! I ended up going back and using guide, I couldn't do most of the things I wanted in the app designer.
App Designer is a complete waste of time and only suitable for toy apps. Even the tutorial examples are ridiculously slow.
Ted H
Ted H on 28 Dec 2022
Moved: Voss on 28 Dec 2022
++ on @Paul Dirac comment.
I am days into getting a simple graph going to slice and dice a large table. In other applications, this effort takes about 30 minutes.
The tutorials on hello world and calculators does not help someone learn to load a .mat file and allow a user to choose inputs to a simple graph.
The program layout does not provide enough information to learn what you don't know (no workspace, use of syntax different than matlab).
@Ted H, yes it is annoying that you have to switch apps from App Designer to MATLAB to see the Command Window or the Workspace Panel. I've let them know strongly several times that those need to be visible in App Designer so we don't need to switch apps to see them.
To load a .mat file, it's no big mystery or complicated thing. It's no more complicated than calling any other function that takes inputs and returns outputs. You simply do
s = load(fileName);
where s is a structure with all the variables in the .mat file as fields, and fileName is the name of the .mat file.
Not sure what you mean by "choose inputs to a simple graph" though. That could be taken many different ways. Maybe you want to call inputdlg to get a number, or maybe you want to get a number from a scrollbar or an option from a radio button, checkbox, or listbox. Maybe you want to call drawfreehand or drawpolygon to lassoo some subset of plotted data points. have no idea what you have in mind. If you care to elaborate (in a new discussion thread/question), we could show you.
Ted H
Ted H on 28 Dec 2022
Edited: Ted H on 28 Dec 2022
@Image Analyst I might ditch app designer. My goal was to set up a simple swarm plot (similar to box and whiskers). My table has about 80 variables of measurements and categories. A user would print a swarm graph of a voltage measurement chosen from a drop down in categories across the x axis chosen by another drop down. An example might be choosing Va from the list (Va, Vb, Vc) and choosing the car variable as the category. The result is a swarm/box plot for each car in that variable across the x axis. What I am finding is appDesigner has only built in axis graph (x,y plotting like to plot a sine wave), and I have to create a swarm plot 'template' in the startup function, if I want to graph in the developed app. I have gotten as far as opening a figure window, but no data shows up. I am not even sure how to troubleshoot that (it works in regular matlab). And I have yet to find examples of how to do this. It should be simple. Matlab might need to redefine their competitors and focus development there.
@Ted H, if you have this working outside of AppDesigner then it can work inside app designer. You can define local private functions within AppDesigner. Move your plotting function from the m file to a local function within the app. If you're not doing so already, specify the axes handles in your plotting commands. For example:
plot(app.UIAxes, __)
The app's startup function can initialize the plot and the plot can be updated any time any parameter value is changed by the users by setting up callback functions for the app components.
Alternatively, your app can generate the plot outside of appdesigner if that's what you're aiming for.

Sign in to comment.

Categories

Find more on Environment and Settings in Help Center and File Exchange

Products

Release

R2019a

Asked:

on 1 Aug 2019

Commented:

on 28 Dec 2022

Community Treasure Hunt

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

Start Hunting!