MATLAB

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 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
2024a matlab/R2024a - KU -
2023a (default) matlab/R2023a - KU -

KU : Available for Kyoto University members only
- : Not available

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.

  • 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.

  • Signal/image processing
  • Communication system design
  • Control system design
  • Experimental measurement
  • Modeling and analysis in computational finance
  • Biotechnology computing, etc.

You can check the available toolboxes by entering the ver command in the command window after starting MATLAB.

Execute the module command to set up the environment. (Load the version of the module file you want to use).

$ module load matlab

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 for details on the tssrun command.

$ tssrun --x11 matlab

To exit MATLAB, select the File menu in the menu bar, then click Exit MATLAB.

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).

You can start MATLAB by specifying the option and executing the following command. Please refer to Interactive Processing for details on the tssrun command.

$ tssrun matlab -nodesktop -nosplash

You can exit MATLAB by executing the following command.

>> quit

If an error message 'Unable to communicate with required MathWorks services (error 5201)' appears when starting MATLAB, please try the following procedure.

$ rm -rf ~/.MathWorks/ServiceHost/*/v[0-9]*

You can reduce computing time by using Parallel Computing Toolbox for parallel processing with multiple workers.

1.Click Parallel > Create and Manage Clusters.

  1. Click Add Cluster Profile > Slurm. If the Product Required screen appears, click "OK".
  2. Click "Edit" in the lower right corner of the screen, and the Profile Setup screen appears then you will need to fill in the following items.
  • R2023a

  • Root folder of MATLAB installation for workers ClusterMatlabRoot
     /opt/system/app/matlab_parallel_server/R2023a_up4_all (For MATLAB 2023a)

  • Resource arguments for job submission: 
     --rsc p=^N^:t=^T^:c=^T^

  • Additional command line arguments for job submission Submitarguments
     -p < queue name >

  • R2024a and later

    • Root folder of MATLAB installation for workers ClusterMatlabRoot
       /opt/system/app/matlab_parallel_server/R2024a_all/ (For MATLAB 2024a)
    • For Additional Properties for plugin scripts Additional Properties, please enter as follows.
Name Value Type
AdditionalSubmitArgs -p < queue name > String

The folder specified in Root folder of MATLAB installation for workers ClusterMatlabRoot depends on the version of MATLAB. Please refer to the following and specify.

Version Folder
R2023a /opt/system/app/matlab_parallel_server/R2023a_up4_all/
R2024a /opt/system/app/matlab_parallel_server/R2024a_all/
  1. Click "Done" when you have finished setting up.

  1. Open the Validation tab and click "Validate".
  2. If the check is completed and the "Status" is "Passed", there is no problem. If the "Status" is "Failed", please review the settings in "Properties".
  3. After completing the settings, click the "×" in the upper right corner to close the Cluster Profile Manager screen.

Specify a cluster profile (e.g., SlurmProfile1) in the input file (xxxxxxxxxxx.m).

c = parcluster('SlurmProfile1')
parpool(c,4)
parfor i = 1:n
    a(i) = max(abs(eig(rand(A))));
end

delete(gcp('nocreate'))

Simulink is integrated with MATLAB and can be activated by entering the following command in the Command Window of MATLAB.

>> simulink

Execute the following command to exit Simulink.

To exit Simulink, select the File menu in the menu bar, then click Close.

You can create a stand-alone executable file by converting a MATLAB m file into a C/C++ source file and then compiling it.

To compile a source file, run MATLAB and enter the following command in the Command Window.

>> mcc -m input_filename

The input file name should be suffixed with m, e.g. xxxxxxxxxxx.m.
The output file will be generated as follows.

「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」

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.

>> mex file_name