-
Notifications
You must be signed in to change notification settings - Fork 36
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
Local functions defined in cells persist across cells. #65
Comments
Thank you for the From the outset, there may be challenges to implement this in a way that disambiguates functions with local cell scope from functions that have notebook scope. Nonetheless a worthwhile feature request! |
Also requested by @christianschroder here. In-lining his thoughts below:
myfun(3, 4)
function c = myfun(a, b)
c = a^2 + b^2;
end
function c = myfun(a, b)
c = a^2 + b^2;
end
myfun(3, 4)
|
Yes, this would be very helpful. One way that I used python notebooks in grad school was to define a main function in a high-up cell that would analyze results for a scenario of parameter values, then plot the results in various ways. In the subsequent cells you could just create a scenario then call that analysis and plotting function. In Matlab notebooks, you can of course define a function in its own .m file and put that on the path, but then you lose access/ability to read that function code right as part of the notebook. |
Hello @rsp34, As of version Kindly let me know if this approach worked or proved useful in solving the issue you are facing. Thank you for using MATLAB Integration for Jupyter! |
Really like "With MATLAB R2022b and later, you can define a local function at the end of the cell where you want to call it".
Would be great if the functions could be called in other cells without re-writing the local function.
The text was updated successfully, but these errors were encountered: