MATLAB Answers

Interative diagram in App Designer

8 views (last 30 days)
JORGE FILHO
JORGE FILHO on 18 May 2020 at 17:12
Edited: Adam Danz on 18 May 2020 at 19:58
Hi Everyone,
I developed a script to analyze hydrologic time series comparing different sites. Now, I would like to implement its interface. But the App Designer is not familiar for me. So, before start studding it, I would like to know if it would support the main functionality I planned for the interface. Is it possible to put a diagram of a water basin containing hydrological sites so as the user can construct an interactive list of sites that will be analyzed clicking on the diagram? I mean, is there a way to create something like the graphic environment of HECHAS on MATLAB? It is not necessary any geographic treatment from now, but just a diagram where the codes of sites would be added to a list by a clicking on them...
There is an attached example of water basin diagram. The station codes have to object.
Thanks

  3 Comments

Adam Danz
Adam Danz on 18 May 2020 at 17:41
@JORGE FILHO , I reduced the image size to 15% so we can see it and removed what appeared to be a duplicate image. The image can be opened in another window at its original size.
I'm unfamiliar with HECHAS so I can't advise you how to replicate it in App Designer.
Off the top of my head there are two ways to go about this, both will require some work.
1) The first is to recreate the diagram within a large axes in the app where you can plot lines, triangular markers, and text objects.
2) The second is to merely put that image on the axes and somehow determine the coordinates of the sites. If the image is constant and won't change, you could mark them manually. Otherwise you may need to use some image processing tools.
If you go with the 1st method, you could assign a button down function to the plotted objects. When the user clicks on the object the function can be programmed to determine which site was selected.
If you go with the 2nd method, after you figure out how to obtain the coordinates of each site from the image, you could use one of several methods to get mouse-click loctation. You may have to use Matlab r2020a or later (if you're reading this in the future) since earlier versions may not support these interactive components. One option is to assing a WindowButtonDownFcn to the UIFigure. You'll have to get the site locations in figure coordinates with that method. you might be able to assign a callback function directly to the image within the axes as well.
JORGE FILHO
JORGE FILHO on 18 May 2020 at 19:44
Dear Adam Danz
Thanks for your reply. I have already imagined that second option using a GIS or something like that. Maybe it is a little advanced goal for an unexperienced frontend programmer like me.
Adam Danz
Adam Danz on 18 May 2020 at 19:58
Whatever you decide to do, it would be very wise to try out a quick & dirty version within AppDesigner before you get too deep into it. Functionality with App Designer and with UIAxes and UIFigures is still behind the functionality supported in regular figures and axes, though it's improving with every release.
For example, the ginput() function might be a nice tool to allow users to select sites but it is not supported in App Designer, yet.
So, be sure to test the plan and know that it will work before you get too deep in the details.

Sign in to comment.

Answers (0)

Sign in to answer this question.

Products