banner



Call A Matlab Function Using App Designer

I explained MVC (Model-View-Controller) in details in my book : . For English readers, you can refer to this Wiki for more details.

The design of the model should reflect the logic of the program. In this example, it is very simple: If someone is depositing the money, apply the following :

balance =  balance +  input          

If someone is withdrawing the money:

balance =  balance -  input          

The second part of MVC pattern is the View, its responsibility includes:

  • Creation of figure and UI objects, and determine where to put them.
  • Hook the ui objects with their callbacks.

In common GUI design, the model is the most stable, the view will subject to lots of improves and changes. The change of the view and presentation should not affect the model. From object orientated programming point of view, we should encapsulate View and Model into different classes, so that they are responsible for different kind of jobs. This is called decoupling.

There are some other responsibilities belong to neither Model or View, we put them into another class called Controller.

In summary, MVC pattern divides the GUI program into the following three parts:

[GUI][MVC][Intro].jpg

For Englisher readers, here is a simplified diagram:

            use model to query internal 			    state, and update the      +--------------------+           view                +-----------------------+ |     Model          |         <-----------------    | View                  | |                    |                               |                       | |                    |                               |                       | |                    |       ----------------->      |                       | +--------------------+        notify the view that   +-----------------------+ 		^              state is changed                 / 		 \                                             /   	      change the                                      /    	   internal state                                 use do some interaction 	    of the model                                  with the view, like  		     \                                    press the button     		      \+----------------------------+     / 		       |     Controller             |    /  		       |                            |   / 		       |                            | <- 		       |                            | 		       +----------------------------+          
  • Model : Responsible for internal logic
  • View : Construct the presentation
  • Controller : Dealing with user interaction, and callbacks passing

The controller takes care of UI callbacks: it deals with first round of reaction, and if some reactions have influence to the internal state of the model, the controller will call the related methods from the model. Sometimes, internal state changes will also need to notify the View to do some visual updates. This is done by notifying the view objects.

Call A Matlab Function Using App Designer

Source: https://lifeinplaintextblog.wordpress.com/matlab-app-designer-tutorial-5-english/

Posted by: shanerattle1974.blogspot.com

0 Response to "Call A Matlab Function Using App Designer"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel