Differentiate different matlab instances opened in GUI

3 ビュー (過去 30 日間)
vivek patel
vivek patel 2022 年 4 月 1 日
コメント済み: Jan 2022 年 4 月 2 日
When we open the matlab through startup.m we add in matlabpath different paths of different libraries.
So for e.g. if user selects x, then we link the libraries of project x in matlab path.
if user selects y, then we link the libraries of project y in matlab path.
Now if a person is working on multiple activities and on multiple projects, he/she may forget with which environment the current MATLAB is opened. So, I was looking for is there any way that we can append some string to the MATLAB GUI to easily check with which environment current matlab is open ?
Note : I cannot add both set of libraries at the same time, as the name of some library files are same which will create conflict. I know in the command window we can display something but if there are lot of commands entered after opening matlab then the data would be lost.
  2 件のコメント
Steven Lord
Steven Lord 2022 年 4 月 1 日
Are you aware of the MATLAB Projects functionality? This may help you organize the files and handle automatically updating the path to reflect what files need to be accessible for each project. It doesn't directly address your question of annotating the Desktop somehow to indicate which project is open but it still might be useful to you in other ways.
vivek patel
vivek patel 2022 年 4 月 1 日
@Steven Lord, yes we are talking about using this across the development team, but still in discussion phase and not yet finalized to move because of legacy and workload for transfering to projects.

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

採用された回答

Jan
Jan 2022 年 4 月 1 日
編集済み: Jan 2022 年 4 月 1 日
You can use FEX: CmdWinTool .
If you want to set the title of Matlab's command windows from inside the startup function, you haveto use a timer:
start(timer('TimerFcn', @SetCWTitle, 'ExecutionMode', 'SingleShot', ...
'StartDelay', 5));
function SetCWTitle(ObjH, EventData) %#ok<INUSD>
CmdWinTool('Title', 'Matlab Instance XY');
stop(ObjH);
delete(ObjH);
end
You can use this tool to change the background of Matlab's command window also, which might be more prominent for the user than the title.
  2 件のコメント
vivek patel
vivek patel 2022 年 4 月 1 日
Thanks, i just have one question why the need of timer ? Maybe because matlab is initializing through startup hence cannot set the title at that time ?
Jan
Jan 2022 年 4 月 2 日
@vivek patel: Yes. Simply try it: Setting the title during the startup.m function is running, works for about 1 second, than it is rest automatically. I assume, the title i set in matlabc.m also or in another routine at starting up.
An option is to do this manually:
function mySetup(V)
switch V
case 1
path('MyListOfFolders/taken/from/anywhere/V1');
CmdWinTool('Title', 'Matlab V1');
CmdWinTool('background', [0.5, 0.5, 1]);
case 2
path('MyListOfFolders/taken/from/anywhere/V2');
CmdWinTool('Title', 'Matlab V2');
CmdWinTool('background', [0.5, 1, 0.5]);
end
Of course, the list of folders must be defined in a usefull way.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by