Can I run a "clear java" command but still keep a variable in the workspace?

4 ビュー (過去 30 日間)
Jered Wells
Jered Wells 2015 年 3 月 16 日
コメント済み: Jered Wells 2015 年 3 月 16 日
Hi:
I am trying to run "clear java" after temporarily modifying some files in the dynamic Java path. This also clears all variables from the workspace. Is there a way to keep one or more variables in the workspace (e.g. a la clearvars)? I'm currently writing the variables I need to a temporary *.mat file, and this seems far too hacky. Thanks all!

回答 (2 件)

Elias Gule
Elias Gule 2015 年 3 月 16 日
I guess you can store those java variables in a structure and run "clear java"; the variables should still be available in the structure;
  1 件のコメント
Jered Wells
Jered Wells 2015 年 3 月 16 日
Elias: STRUCT arrays are cleared along with all other variables in the workspace when calling "clear java." I am looking for a command or method which can be used to keep a specified variable in the workspace when calling "clear java."

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


Guillaume
Guillaume 2015 年 3 月 16 日
The documentation of clear is very clear (!). Only class definitions and import are not cleared by clear java. The only way to keep your variables is indeed to save and restore them.
  1 件のコメント
Jered Wells
Jered Wells 2015 年 3 月 16 日
Fair enough - and an extra point to you for the pun!

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

カテゴリ

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