vios
vios

Reputation: 1

How to code Matlab in VSCode via Jupyter Notebook?

My Jupyter kernel is running well since I can do Matlab jobs using a 'browser jupyter notebook' as well as when I was coding in Python. And I can also code Python in my notebooks via VSCode. But it seems weird that I can't code Matlab in notebooks via VSCode. Are there anything that I didn't notice which leads me to this error? Thanks a lot!

Upvotes: 0

Views: 2162

Answers (1)

paulomarconi
paulomarconi

Reputation: 21

I had the same problem, and I tried several approaches.

  • Adding Matlab and Python kernel path into VSCode "settings.json" file -> didn't work.
  • Running VSCode with admin rights -> didn't work.
  • Running "jupyter notebook" and "activate jmatlab" (aka matlab_kernel) with the VSCode terminal -> didn't work.

So, there are two solutions.

  1. Launch VSCode using Anaconda Navigator.

Launch VSCode using Anaconda Navigator

After selecting the jmatlab environment, select one of the two Matlab kernels and run the Matlab code.

Matlab and Python kernel

  1. Launch VSCode with the command line.
    • Open terminal (cmd).
    • Activate the jmatlab environment anywhere you want -> C:> activate jmatlab
    • Launch VSCode by simple typing -> (jmatlab)C:> code
    • Test your Matlab code.

Upvotes: 2

Related Questions