Maintain actxserver handle during clear

8 ビュー (過去 30 日間)
John Broderick
John Broderick 2015 年 5 月 22 日
コメント済み: Image Analyst 2015 年 5 月 22 日
I am working on developing a Matlab interface to a external program using activex controls. I have got everything working, but have one annoying issue. Whenever the user clears the workspace, the application shuts down. While there is little risk of data loss, restarting the program is an annoyance due to acquiring licenses.
So, is there a way to prevent this from happening? One possibility is to overload clear so that it deletes everything except for the server handle. However, I don't want to overload a base Matlab function. I will also be distributing this to coworkers, so I would rather not require everyone to use clear -except when working with this interface. Is there a way to mark a variable as undeleteable during the basic clear operation (i.e. the only way to delete it would be to write clear var)?
Thanks.

回答 (1 件)

Guillaume
Guillaume 2015 年 5 月 22 日
You could possibly use mlock with some persistent variables.
However, if the user did not mean to clear all variables when using clear, maybe they shouldn't be using it?
  3 件のコメント
Guillaume
Guillaume 2015 年 5 月 22 日
Indeed. A technical workaround is only going to hide the underlying issue that the user is not doing what he should / meant.
Image Analyst
Image Analyst 2015 年 5 月 22 日
Sounds like a "user training" issue to me.

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by