Borrar filtros
Borrar filtros

Simple encapsulation of a function?

6 visualizaciones (últimos 30 días)
Balaji
Balaji el 1 de Jul. de 2014
Respondida: Vishal_R el 3 de Jul. de 2014
Hi all,
I have a simple question on the availability of a certain feature in Matlab. Let us say I have a script like the one below:
a= 1;
b= 2;
c= b+a;
What i want to do is
  1. select the third line.
  2. press a magic button.
Then matlab should creates a function like this
function c = autoGeneratedFunctionName(a,b)
c=a+b;
end
In essence matlab should identify the input and output variables of the selected block, and create a function file with them. Such a feature already exists in simulink (where you select a group of blocks, right click and ask matlab to make a subsystem out of the block).
Does this magic button exists?
Why am I asking for this feature? A huge number of people(I know 2, without including myself), do big scripts while development and later put chunks of code into manageable small functions once the script runs fine. This feature, if it exists, would save a lot of time.
Thanks for reading,
Balaji Sankar.

Respuestas (1)

Vishal_R
Vishal_R el 3 de Jul. de 2014
This feature has not been supported as of now. There is no such magic button which will encapsulate your code.

Categorías

Más información sobre Verification, Validation, and Test en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by