フィルターのクリア

Calling the same function from multiple scripts

12 ビュー (過去 30 日間)
Priyanka Mehta
Priyanka Mehta 2015 年 10 月 30 日
コメント済み: Walter Roberson 2015 年 10 月 30 日
I am calling a function from multiple scripts in separate Matlab windows at the same time. Would this affect my function's output? Would this make the process slow?

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 10 月 30 日
It should be fine as long as you are avoiding "clear all" and "clear functions"
  2 件のコメント
Priyanka Mehta
Priyanka Mehta 2015 年 10 月 30 日
Thank you for your prompt response. I do not have 'clear all' in my function or 'clear functions' in my main script. But I do have global variables in my main script as well as the function. Would the function call from one script interfere with the other? Or would they still run independently?
Walter Roberson
Walter Roberson 2015 年 10 月 30 日
It depends what you mean by "separate MATLAB windows". If you mean that you started multiple sessions each with its own command window, then they will not interfere with each other (provided you are not changing the .m files as you go!).
If you mean multiple figures, all started from the same command window, then Yes, the global variables would be shared. global variables apply across all activities within the same process.
If you are trying to use global variables with the Parallel Processing Toolbox then you need to know that the contents of global variables are not copied from the original process to the workers, and changes to the globals on one worker do not affect the other workers.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeWhos についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by