--- title: MATLAB published: true taxonomy: category: - docs external_links: process: true no_follow: true target: _blank mode: active --- [toc] ## Environment Settings{#enviroment} ### Software Version and System Requirements{#version} The Modules software package can dynamically switch and set the environment settings required to use the application by executing the module command. And you can change the environment settings easily when you switch to the different version of the application. Please refer to [Modules](/config/modules) for details. You can check a list of available module files with the module avail command. Version | Module File Name | System A |System B/C/G | Cloud System -------------------- | -------------------- | ----- | ----- | --- 2023a (default) | matlab/R2023a | - | KU | - KU : Available for Kyoto University members only \- : Not available ## Software Overview{#overview} MATLAB is a high-performance language for technical computation that integrates computation, visualization, and programming capability. It supports various types of vector and matrix calculation, which are fundamental for solving engineering and science technology problems. MATLAB allows you to use various mathematical functions of linear algebra, partial differential equation, and others for data analysis. It is equipped with 2D and 3D graphics functions that visualize data. It allows subroutines of other languages such as C, C++, and Fortran to be called as if they are built-in functions. MATLAB widens its application area by Toolbox, which is an assortment of non-basic MATLAB functions for special class problems. ### Options{#option} * **Simulink** Simulink is a platform for multi-domain simulation, dynamic system, and model base design of embedded systems. Its interactive graphical environment and block libraries allow you to design, simulate, implement, and test time-dependent systems in fields such as communication, control, motion picture processing, and still image processing. ### Areas of Application{#app-area} * Signal/image processing * Communication system design * Control system design * Experimental measurement * Modeling and analysis in computational finance * Biotechnology computing, etc. ### Available Toolboxes{#toolbox} You can check the available toolboxes by entering the `ver` command in the command window after starting MATLAB. ## How to Use{#usage} ### Environment settings(Executing the module Command){#env_set} Execute the **module** command to set up the environment. (Load the version of the module file you want to use). ```nohighlight $ module load matlab ``` ### MATLAB{#matlab} #### GUI Mode You can start MATLAB by executing the following command in an environment where FastX, NiceDCV with the X Window System is available. Please refer to [Interactive Processing](/run/interactive) for details on the **tssrun** command. ```nohighlight $ tssrun --x11 matlab ``` To exit MATLAB, select the **File** menu in the menu bar, then click **Exit MATLAB**. ![](matlab_example_01.png) The following login screen will be displayed when you start up the system for the first time. If you are a Kyoto University member, please enter your university address (@kyoto-u.ac.jp or @st.kyoto-u.ac.jp). ![](matlab_initial_login.png) #### CUI Mode You can start MATLAB by specifying the option and executing the following command. Please refer to [Interactive Processing](/run/interactive) for details on the **tssrun** command. ```nohighlight $ tssrun matlab -nodesktop -nosplash ``` You can exit MATLAB by executing the following command. ```nohighlight >> quit ``` #### What to do if the startup fails If an error message **'Unable to communicate with required MathWorks services (error 5201)'** appears when starting MATLAB, please try the following procedure. ```nohighlight $ rm -rf ~/.MathWorks/ServiceHost/*/v[0-9]* ``` ### Simulink{#simulink} Simulink is integrated with MATLAB and can be activated by entering the following command in the Command Window of MATLAB. ```nohighlight >> simulink ``` ![](matlab_example_02.png) Execute the following command to exit Simulink. To exit Simulink, select the **File** menu in the menu bar, then click **Close**. ### MATLAB Compiler{#matlab_comp} You can create a stand-alone executable file by converting a MATLAB m file into a C/C++ source file and then compiling it. #### How to compile To compile a source file, run MATLAB and enter the following command in the Command Window. ```nohighlight >> mcc -m input_filename ``` #### Input/Output files The input file name should be suffixed with m, e.g. xxxxxxxxxxx.m. The output file will be generated as follows. ```nohighlight 「xxxxxxxx 」…executable file 「run_xxxxxxxx.sh」…Scripts for running executable files. 「xxxxxxxx_mcc_component_data.c」 「xxxxxxxx.prj」 「xxxxxxxx_main.c」 「mccExcludedFiles.log」 「readme.txt」 ``` ### Calling External Program From MATLAB{#matlab_excall} C or Fortran subroutines can be called from MATLAB like built-in functions by creating a MEX file.. To compile a source file, run MATLAB and enter the following command in the Command Window. ```nohighlight >> mex file_name ``` ## References{#references} ### References in Japanese{#ref_ja} * [製品ドキュメンテーション(The MathWorks, Inc.)](http://www.mathworks.co.jp/access/helpdesk_ja_JP/help/helpdesk.html) ### References in English{#ref_en} * [Documentation Center (MathWorks, Inc.)](http://www.mathworks.co.jp/help/documentation-center.html) ## Links{#link} ### External Links{#ex_link} * [The MathWorks, Inc.(The MathWorks, Inc.)](http://www.mathworks.co.jp/)