Python Programming in MatDeck

MatDeck programming is done using MatDeck scripts with an atmosphere reminiscent of C++. However, we now also include a new feature of programming in Python. MatDeck’s framework allows for simultaneous text editing, script language coding (including both: MatDeck Script and Python), GUI capabilities and data visualization – we cater for all levels of users and experience.

Greater processing speeds can be reached by executing MatDeck document and Scripts using “Build and Run Exe” option. Maximum computational speed can be reached as well as the option to write low level processing procedures in C++ language and then adding them in as plug-ins.

Here, you will find an example which illustrates how Python code is written and execute in MatDeck documents. Further, other examples depict how to exchange variable between MatDeck Script and Python, as well as specific scenarios regarding Python programming in MatDeck.

Python scripts are written within MatDeck documents using Python keywords and syntax in the regular Code Editor in text mode and is separated by using tags, such as #py…###. The user can also have a special MatDeck document which only contains Python code. Variables defined in MatDeck script can be exchanged to Python for further processing and returned.

There is a type match for MatDeck variables: Boolean, integer, double, complex, string, vector which is interpreted as a Python list. Python tuple variable is transferred back to MatDeck as a vector. Use of graphics, GUI and widgets make programming more interactive and easier to learn for users.

MatDeck and Python consist of numerous graphical options even within standard distributions. Python graphics can eb used in MatDeck. However, graphic objects created in Python cannot be embedded or accessed in MatDeck documents – they are fully separated as Python objects can only be manipulated by Python.


MatDeck Python examples for LabJack T series

Example Python 1 – Python_Document_LabJackConfig (PDF, MDD)

  • Running Python for LabJack T series DIO configuration in PWM mode within a MatDeck document
  • Compound Python code with image, text, titles and other MatDeck features
  • Improving Python limitations by generating results simultaneously in the same document (result reads the counter value after one second)

Example Python 2 – Python_in_MatDeck_LabJackConfig (PDF, MDD)

  • Using dedicated MatDeck Python Editor to code for LabJack T series DIO configuration in PWM mode. In addition you can open it in a .PY file        

Example Python 3 – Python_MatDeck_GUI_LabJackConfig (PDF, MDD)