Automatically generate functions from snippet of a script

4 views (last 30 days)
When I write a code in matlab, I usually start writing a script. When the script gets bigger, I transform it into a function and I start splitting it into sub-functions.
I wonder if there is an automatic way to transform a snippet of code into a function. What I mean is just generating the header with input. Matlab is already able to recognize variables that are declared in a function and variables that are not. Provided the output of a function, all the variables that are not declared should be automatically written in the header input.
I don't know if something like this exists, but it would be a huge saving of time!

Answers (0)


Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by