Skip to content

Debugging MATLAB and Python functions in the same session #281

@mikecroucher

Description

@mikecroucher

Imagine I have some MATLAB code that calls a python function

x = linspace(-10,10,100);
py.mikesPyFunc.doSomethingInPython(x)

The Python function looks like this

import numpy as np

def doSomethingInPython(vec: np.ndarray) -> np.ndarray:
    """
    Accepts a numpy vector and returns a new vector where each element is:
    sin(x) + log(abs(x) + 1) + sqrt(abs(x))
    """
    print("Inside Python function doSomethingInPython");
    return np.sin(vec) + np.log(np.abs(vec) + 1) + np.sqrt(np.abs(vec))

What I'd like to be able to do is put a break-point in the Python function, lets say at the print function to keep things concrete. Then, when I run the MATLAB code, the debugger stops inside the Python function.

Could this be possible?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions