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 CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by