0

I want to change the title of the the command window in matlab to state the current branch I am working on. I know where to find the current branch name. I need that every time this file is changed to note on a new branch, the title of the command window will be updated with the new branch name.

Any thoughts?

matino
  • 17,199
  • 8
  • 49
  • 58
user2549704
  • 51
  • 1
  • 2
  • The answers to this question -- http://stackoverflow.com/questions/1924286/is-there-a-way-to-change-the-title-of-the-matlab-command-window?rq=1 -- may help. – High Performance Mark Jul 04 '13 at 11:02
  • Hi,I need to change it dynamically and not just for the first time. I need to keep track on the changed file and update the command window. – user2549704 Jul 04 '13 at 11:50

1 Answers1

0

I have this M-file laying around (I think I got it from here). It might suit your needs:

function idetitle(Title)
%IDETITLE Set Window title of the Matlab IDE
%
% Examples:
% idetitle('Matlab - Foo model')
% idetitle(sprintf('Matlab - some big model - #%d', feature('getpid')))

    win = appwin();
    if ~isempty(win)
        win.setTitle(Title);
    end
end

function out = appwin()
    %APPWIN Get main application window

    wins = java.awt.Window.getOwnerlessWindows();
    for ii = 1:numel(wins)
        if isa(wins(ii), 'com.mathworks.mde.desk.MLMainFrame')
            out = wins(ii);
            return
        end
    end

    out = [];

end
Community
  • 1
  • 1
Rody Oldenhuis
  • 37,726
  • 7
  • 50
  • 96