Model View Control Pattern using GUIDE

版本 1.0.0.0 (9.0 KB) 作者: Chris Schwarz
A simple GUIDE with Uicontrols is modified to demonstrate the application of MVC in Matlab.
1.7K 次下载
更新时间 2013/2/13

查看许可证

Model View Controller (MVC) is a compound pattern whose goal is to separate responsibilities into modular pieces that can be interchanged relatively easily. If you didn't need a user interface, all you'd have to worry about is the model. Why should you have to burden the model with user interface code? Obviously you shouldn't, thus the model view separation. Introduction of a controller loosens the coupling between the model and the view and, if done well, allows the behavior of the system to be modified by replacing the controller with a different one.

I'm following the MVC example laid out in the excellent book Head First Design Patterns. My starting point is the quick start GUIDE 'GUI with Uicontrols'. If you choose this GUIDE template and view the m file, you can see how it started and compare it to the MVC version I am presenting. Of course there are a few idiosyncrasies that the Matlab scripting language imposes. The main one is that the user interface is not a class; rather, it is a handle graphics object. The good news is that it's not hard to work around.

A blog post that describes the implementation can be found at: http://myunscriptedblog.blogspot.com/2013/02/mvc-in-matlab.html

引用格式

Chris Schwarz (2024). Model View Control Pattern using GUIDE (https://www.mathworks.com/matlabcentral/fileexchange/40294-model-view-control-pattern-using-guide), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2010a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0.0