Hi, I have a function that is used in different scripts. I would know if is more time saving changing the name of the function and use for each script different functions.
I'm worried about the fact that if one function is opened in a script, the other script have to wait that the function is closed to open again the same function and in this way the computational time gets longer.
Thanks.

댓글 수: 2

Stephen23
Stephen23 2019년 4월 11일
편집: Stephen23 2019년 4월 11일
" I would know if is more time saving changing the name of the function and use for each script different functions."
No. That would just make managing your code more difficult and slow your code down.
"I'm worried about the fact that if one function is opened in a script, the other script have to wait that the function is closed to open again the same function and in this way the computational time gets longer."
MATLAB functions are not "opened" or "closed" when they are run (and certainly not individually each time they are called). MATLAB code is compiled and stored in memory: it makes no difference after that how many times it is called or from where. Your proposal (of making multiple copies of a function) would slow down your code because every function would need to be compiled separately (thus also pointlessly wasting memory):
So far I do not see any single advantage in what you are proposing.
Antonio Boccamazzo
Antonio Boccamazzo 2019년 4월 11일
Very clear. Thank you very much.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Application Deployment에 대해 자세히 알아보기

제품

질문:

2019년 4월 11일

댓글:

2019년 4월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by