mathworks / mathworks/MATLAB-extension-for-vscode

Debugging MATLAB and Python functions in the same session

Open
#281 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
435
Forks
40
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the MATLAB call to py.mikesPyFunc.doSomethingInPython(x) and the Python function shown in the issue, then investigate how MATLAB and Python debugging interact in VS Code. Done means a breakpoint at the Python print statement is hit when the MATLAB code invokes the function, with the behavior documented or tested.

Written by the indexing model from the issue text.

Assessment

Tech stack
matlab, python, vscode
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.