필터 지우기
필터 지우기

Simple encapsulation of a function?

조회 수: 6 (최근 30일)
Balaji
Balaji 2014년 7월 1일
답변: Vishal_R 2014년 7월 3일
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.

답변 (1개)

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

카테고리

Help CenterFile Exchange에서 Verification, Validation, and Test에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by