Introduction: Call MATLAB Script and Function From Python

Picture of Call MATLAB Script and Function From Python

Hi friends . In this instructable I will show you how to run MATLAB scripts and call MATLAB functions from python code.

Step 1: Softwares Needed

Picture of Softwares Needed
  • MATLAB version R2014b or above.
  • Python version 2.7 or above.

Step 2: Find MATLAB's Root Folder

Picture of Find MATLAB's Root Folder
  • Open MATLAB.
  • Type "matlabroot" in command window of MATLAB.
  • Answer shows the root folder of the MATLAB that you have installed.

Step 3: Install Python API for MATLAB

Picture of Install Python API for MATLAB
  • Open Command Prompt and change the directory to "C:\Program Files\MATLAB\R2017a> cd extern\engines\python"
  • Run "" in that directory by using this command "python install"

Step 4: Code

  • used to run a MATLAB script named basicsignals.m
  • used to call the MATLAB function named triarea

Step 5: Output

Picture of Output

You will get this output for the file...........

Try it out......................


About This Instructable




Bio: Engineering Student................
More by GaneshL6:Call MATLAB Script and Function From PythonIoT Based Temperature Monitor
Add instructable to: