User Tools

Site Tools


en:software:matlab:ta:dev:module:index

Writing Submodules

A to-be-written HOWTO covering how to write (and add) submodules for and to the toolbox.

Suppose you use the toolbox frequently but are very much interested in an additional set of functions that most probably cover a specific problem. That would be the perfect scenario for writing your own submodule that integrates seamlessly with the toolbox.

The following guide will try to help you sorting things out and give you a few ideas that might prove useful in writing your own modules.

Please note: Although having modular design in mind from the very beginning, some of the very useful (and perhaps even necessary) functions to integrate modules in the toolbox still have to be developed. Therefore, this is work in progress.

Before you start

Familiarise yourself with the basic concepts and the directory structure of the toolbox.

Furthermore, it is a good idea to read through the developer's basics, if you haven't already done that.

Directory layout of your module

The first step is probably to decide about a proper short name for your module, as all your function files that you write for this module that do the actual work (not the GUI files, if you plan to add a GUI) go into that directory.

An example could be “sim” for a module performing simulations.

<note tip>Why is this important? The easy answer: If you follow these rules for your directory layout, every user interested in installing your module could easily just take the ZIP file of your module (given that the ZIP archive preserves the internal directory structure of your module) and unzip it into the main directory of his toolbox.</note>

If you plan to add a GUI, things become a bit more complex, as you should follow the generic directory structure of the toolbox to allow for seamless integration of your module. Therefore, add the following additional directories to your module:

  • GUI
    • private
      • helptexts
        • <YourModuleName>

Your main GUI routine will reside in the GUI directory, your help files for that GUI1) in GUI/private/helptexts/<YourModuleName>.

Your GUI helpwindow will reside in GUI/private and should have a generic name: TAgui_<YourModuleName>_helpwindow.m.

Infrastructure for writing your own GUI

If you plan to write your own GUI window, there is a whole set of functions that might be important for you - especially if it comes to writing datasets (back) to the main GUI window.

For writing GUIs with a consistent look&feel to the rest of the toolbox, have a look at the GUI-specific basic ideas and concepts. The GUI part of the developers' documentation should get you started in terms of actual programming. Please note that the former tries to familiarise you with the basic ideas and concepts, whereas the latter gives you more detailed code examples and hints.

<note important>Interaction between your GUI window and the main GUI window should in any instance be based on generic functions provided by the main GUI, especially if you want to write to the main GUI.</note>

There is a list of functions for handling dataset exchange with the main GUI:

  • appendDatasetToMainGUI
  • refreshDatasetInMainGUI
  • removeDatasetFromMainGUI
  • saveAsDatasetInMainGUI
  • saveDatasetInMainGUI
1)
Every GUI window should come with its own, builtin help to make it easier for the user to use it.
en/software/matlab/ta/dev/module/index.txt · Last modified: 2020/09/30 21:35 by 127.0.0.1