Effacer les filtres
Effacer les filtres

Simple encapsulation of a function?

6 vues (au cours des 30 derniers jours)
Balaji
Balaji le 1 Juil 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.

Réponses (1)

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

Catégories

En savoir plus sur Verification, Validation, and Test dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by