Function for more scripts slower?

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 ExchangeApplication 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