Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8856623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:23:50+00:00 2026-06-14T14:23:50+00:00

I have a platform for python scripting, and I would like to call matlab

  • 0

I have a platform for python scripting, and I would like to call matlab functions inside. I have found several threads tackling the issue, among them those two

How do I interact with MATLAB from Python?

Running m-files from Python

However, threads are either not recent, or not very detailed.

  1. is mlabwrap reliable?
  2. what would you advocate as a solution to call matlab functions / .m files in python script?
  3. using win32com from python to call a matlab session –> is this a good idea ? could you point to more doc or examples on this topic?

looks like link to sourceForge is not up to date, last update 2010,

http://sourceforge.net/projects/mlabwrap/

  1. Could you hint at some latest version ?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:23:51+00:00Added an answer on June 14, 2026 at 2:23 pm

    I would still recommend mlabwrap as the solution for this.
    I use mlabwrap on a regular (weekly?) basis, on both Linux and Windows, across several different versions of Python, and several different versions of Matlab. To answer your specific questions:

    1. mlabwrap will reliably perform across platforms, Python, and Matlab versions. It does however have limitations, and it will reliably fail when pushed past those limitations. Usually, these can be worked around.
    2. See my answer here for more information on calling Matlab functions vs. Matlab scripts through mlabwrap. This answer also describes how to workaround one of the primary limitations of mlabwrap, which is that not all Matlab objects can be directly converted into Python objects.
    3. I don’t know anything about calling Matlab using win32com.

    I have used mlabwrap in what I’ll term ‘Python-primary’ style, where the majority of the programming in Python, using Matlab as a library for specific mathematical functions that aren’t available in scipy/numpy, and in a ‘Matlab-primary’ style, the majority of the programming is in Matlab, and the final results are importedinto Python for use in some external process.

    For Python-primary, the thing to keep in mind is that not all Matlab functions will return Python-readable data. mlabwrap will return a MLabObjectProxy object from these functions. These commonly occur when you use Matlab functions to create objects that are passed into other Matlab functions to actually process the data. For example, you can use the digital signal processing toolbox to create a Welch spectrum object which you can then use to get the power spectrum of your data. Theoretically, you can pass these MLabObjectProxies into Matlab functions that require them. In my experience the more you pass these back and forth, the more likely you are to find a bug in mlabwrap. What you can do instead is write a simple Matlab wrapper function obtains the object, processes the data, and then returns appropriate output as an array.

    You can also get around problems with the MLabObjectProxies by using the low-level commands in mlabwrap. For example, if I have a matlab_struct that is a struct array with field matlab_struct.label, and I only want the labels on the Python side, I can do the following:

    # place matlab_struct into the Matlab workspace 
    mlab._set('matlab_struct', matlab_struct) 
    # convert the labels into a cell array
    matlab_struct_labels = mlab.eval('{matlab_struct.labels}')
    

    The main low-level commands available are mlab._set('variable_name', variable), mlab.eval('command string'), and mlab.get('variable_name').

    If I’m doing a lot of heavy-duty processing in Matlab, say in a toolbox or plugin that isn’t available elsewhere, I’ll write what I call ‘Matlab-primary’ code, where I try to avoid passing data back and forth through mlabwrap, instead manipulating variables in the Matlab workspace by calling .m scripts, saving the resulting output to a data file, and importing that into my Python code.

    Good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Imagine you have a NB Platform application and you would like to use that
I would like to have a cross platform framework as these platform solutions. My
I would like to be able to spawn a process in python and have
I have a Python 3.2 program that runs like this: import platform sysname =
I tried several Python IDEs (on Windows platform) but finally I found only Eclipse
In python I have variables base_dir and filename . I would like to concatenate
i have installed lxml2.2.2 on windows platform(i m using python version 2.6.5).i tried this
I have a Python script that I'd like to compile into a Windows executable.
From Python, I would like to retrieve content from a web site via HTTPS
I am trying to write a cross-platform python program that would run in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.