Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

%%file magic broken #71

Closed
benkay86 opened this issue Nov 2, 2023 · 2 comments
Closed

%%file magic broken #71

benkay86 opened this issue Nov 2, 2023 · 2 comments
Assignees
Labels
answered Issue has been answered file-magic question Further information is requested

Comments

@benkay86
Copy link

benkay86 commented Nov 2, 2023

There seems to be an issue with writing functions in Jupyter notebooks. I have the following cell:

%%file hello.m

function hello()
    disp("Hello world!");
end

And I get:

Function definition are not supported in this context. Functions can only be created as local or nested functions in code files.

Error in jupyter.execute (line 51)
resp = jsondecode(matlab.internal.editor.evaluateSynchronousRequest(request));

Error in processJupyterKernelRequest (line 54)
            output = jupyter.execute(code, kernelId);

Error in connector.internal.fevalMatlab

Error in connector.internal.fevalJSON

Running jupyterlab 4.0.6, Matlab R2021a (9.10.0.1602886), and jupyter-matlab-proxy 0.7.2.

@rashedmyt rashedmyt self-assigned this Nov 3, 2023
@rashedmyt rashedmyt added feature request question Further information is requested and removed feature request labels Nov 3, 2023
@rashedmyt
Copy link
Member

Hi @benkay86

Thank you for trying out MATLAB Integration for Jupyter.

Currently, MATLAB Kernel does not support magics which are provided by IPython
and Metakernel. Hence, the line %%file hello.m will be treated as a comment in
MATLAB language.

Also, support for functions within a cell is only valid if it is also being used
in the same cell. For example

hello()

function hello()
    disp("Hello world!");
end

Currently, MATLAB Kernel does not support cross-cell function definition and usage.
If you are interested in this feature, please subscribe to #65
to get notified with related updates.

Hope this answers your query.

@rashedmyt rashedmyt added answered Issue has been answered waiting for response labels Nov 9, 2023
@benkay86
Copy link
Author

benkay86 commented Nov 9, 2023

Ah, my mistake. The documentation I was following was actually for an older, not-official Jupyter-Matlab integration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered Issue has been answered file-magic question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants