f



How to display MATLAB version (e.g., "MATLAB 7.1") in Windows taskbar?

I am working on converting some MATLAB code from version 6.5.2 to 7.1 and 
often have several (up to three) versions of MATLAB running at the same 
time. Each one shows up in the Windows taskbar with just the name "MATLAB."

Is there a way to have it display something like "MATLAB 7.1" and "MATLAB 
6.5.2" so I can easily tell which version is which from just the taskbar?

Thanks,
Peter Neumann 


0
no_one4609 (20)
10/20/2005 7:04:03 PM
comp.soft-sys.matlab 211266 articles. 17 followers. lunamoonmoon (258) is leader. Post Follow

8 Replies
3069 Views

Similar Articles

[PageSpeed] 34

This is a multi-part message in MIME format.
--------------080708050208070604060508
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

No one at nowhere wrote:
> I am working on converting some MATLAB code from version 6.5.2 to 7.1 and 
> often have several (up to three) versions of MATLAB running at the same 
> time. Each one shows up in the Windows taskbar with just the name "MATLAB."
> 
> Is there a way to have it display something like "MATLAB 7.1" and "MATLAB 
> 6.5.2" so I can easily tell which version is which from just the taskbar?
> 
> Thanks,
> Peter Neumann 
> 

Hi Peter,
Save the attached M-file on your MATLAB path, and type "help mlTitle". 
It should do the trick for you.

HTH,
Idin Motedayen-Aval


--------------080708050208070604060508
Content-Type: text/plain;
 name="mlTitle.m"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="mlTitle.m"

function mlTitle(varargin)
%MLTITLE Assigns a title to the MATLAB taskbar icon
%   MLTITLE Changes the taskbar icon to reflect the release and service
%   pack information.  For example: MATLAB R14sp1's icon would read "R14sp1".
%   If you are running from a cluster, MLTITLE will assign the name of the
%   cluster to the title.  If you are in your sandbox, MLTITLE will display
%   "sandbox" and append the root directory name.
%
%   MLTITLE(str1,str2...) Concatenates the string arguments and assigns the
%   result to the taskbar icon.  Any string is valid, but one that is too
%   long may not fit on the icon.
%
%   MLTITLE will only work for releases 12,13 and 14. 

%   Jeremy Nersasian
%   December 2, 2004
%   v1.0
%
%   Modified by Alexander Mueller
%   September 22, 2005
%   v1.0.0.0.1
release = version('-release');

switch release(1:2)

    case '14'
        import com.mathworks.mde.desk.*
        b = MLDesktop.getInstance;
    case {'13','12'}
        import com.mathworks.ide.desktop.*
        b = MLDesktop.getMLDesktop;
    otherwise
        error('This function only works for R12 and later')
end

ml = b.get('MainFrame');
if isempty(ml)
    disp('Must have desktop enabled to use mlTitle');
    return
end
sp = version('-description');

if ~isempty(sp)
    switch sp(1)
        case 'P'
            s = ' pre';
        case 'S'
            s = 'sp';
    end
    sp = [s sp(end)];
    
else
    sp = '';
end

if nargin == 0
    if isempty(getenv('MWE_VERSION'))
        title = ['R' release sp];
    else
        if strfind(getenv('MWE_VERSION'),'pwd')
            matlabpath = getenv('MATLAB');
            slash = findstr(matlabpath,filesep);
            matlab = findstr(matlabpath,'matlab');
            slash = slash(slash<matlab);
            sbver = matlabpath(slash(end-1)+1:slash(end)-1);
            title = ['sandbox ' sbver];
        else
            title = getenv('MWE_VERSION');
        end
    end
else
    title = [];
    for i=1:nargin
        title = [title varargin{i} ' '];
    end
end

ml.setTitle(title)
 
       
--------------080708050208070604060508--
0
imoteday (163)
10/20/2005 7:35:02 PM
Idin Motedayen-Aval wrote:
>
>
> No one at nowhere wrote:
>> I am working on converting some MATLAB code from version 6.5.2
to
> 7.1 and
>> often have several (up to three) versions of MATLAB running at
> the same
>> time. Each one shows up in the Windows taskbar with just the
name
> "MATLAB."
>>
>> Is there a way to have it display something like "MATLAB 7.1"
and
> "MATLAB
>> 6.5.2" so I can easily tell which version is which from just
the
> taskbar?
>>
>> Thanks,
>> Peter Neumann
>>
>
> Hi Peter,
> Save the attached M-file on your MATLAB path, and type "help
> mlTitle".
> It should do the trick for you.
>
> HTH,
> Idin Motedayen-Aval
>
>

This is a text-based newsgroup. If the code is not to long, post it
in a message, otherwise post it to the file exchange at
www.matlabcentral.com.

/PB
0
PB
10/20/2005 8:07:02 PM
PB:
<SNIP mainframe title evergreen...

> Idin Motedayen-Aval:
  appended a file, which does not show up in TMW's NG

> This is a text-based newsgroup. If the code is not to long, post it
in a message, otherwise post it to the file exchange at
www.matlabcentral.com...

as usual, i fully agree with <pb>
i don't know the file's contents either, howver, for this problem,
we've been using this simple snippet

     import com.mathworks.mde.desk.*;
     desk=MLDesktop.getInstance;
     frame=desk.getMainFrame;
     frame.setTitle('hello PB');

us
0
us1 (8051)
10/20/2005 8:13:24 PM
us wrote:
>
>
> PB:
> <SNIP mainframe title evergreen...
>
>> Idin Motedayen-Aval:
> appended a file, which does not show up in TMW's NG
>
>> This is a text-based newsgroup. If the code is not to long,
post
> it
> in a message, otherwise post it to the file exchange at
> www.matlabcentral.com...
>
> as usual, i fully agree with <pb>
> i don't know the file's contents either, howver, for this problem,
> we've been using this simple snippet
>
> import com.mathworks.mde.desk.*;
> desk=MLDesktop.getInstance;
> frame=desk.getMainFrame;
> frame.setTitle('hello PB');
>
> us

Hello <us>, nice java-trick.

/PB
0
PB
10/20/2005 8:38:15 PM
Thanks a million for the M-file. I added a call to it in my startup.m file 
and it works for MATLAB 6.5.2, 7.0.4 and 7.1 that I've got running.

"Idin Motedayen-Aval" <imoteday@mathworks.com> wrote in message 
news:dj8rh6$c2g$1@fred.mathworks.com...
> No one at nowhere wrote:
>> I am working on converting some MATLAB code from version 6.5.2 to 7.1 and
>> often have several (up to three) versions of MATLAB running at the same
>> time. Each one shows up in the Windows taskbar with just the name 
>> "MATLAB."
>>
>> Is there a way to have it display something like "MATLAB 7.1" and "MATLAB
>> 6.5.2" so I can easily tell which version is which from just the taskbar?
>>
>> Thanks,
>> Peter Neumann
>>
>
> Hi Peter,
> Save the attached M-file on your MATLAB path, and type "help mlTitle".
> It should do the trick for you.
>
> HTH,
> Idin Motedayen-Aval
>
>


--------------------------------------------------------------------------------


> function mlTitle(varargin)
> %MLTITLE Assigns a title to the MATLAB taskbar icon
> %   MLTITLE Changes the taskbar icon to reflect the release and service
> %   pack information.  For example: MATLAB R14sp1's icon would read 
> "R14sp1".
> %   If you are running from a cluster, MLTITLE will assign the name of the
> %   cluster to the title.  If you are in your sandbox, MLTITLE will 
> display
> %   "sandbox" and append the root directory name.
> %
> %   MLTITLE(str1,str2...) Concatenates the string arguments and assigns 
> the
> %   result to the taskbar icon.  Any string is valid, but one that is too
> %   long may not fit on the icon.
> %
> %   MLTITLE will only work for releases 12,13 and 14.
>
> %   Jeremy Nersasian
> %   December 2, 2004
> %   v1.0
> %
> %   Modified by Alexander Mueller
> %   September 22, 2005
> %   v1.0.0.0.1
> release = version('-release');
>
> switch release(1:2)
>
>    case '14'
>        import com.mathworks.mde.desk.*
>        b = MLDesktop.getInstance;
>    case {'13','12'}
>        import com.mathworks.ide.desktop.*
>        b = MLDesktop.getMLDesktop;
>    otherwise
>        error('This function only works for R12 and later')
> end
>
> ml = b.get('MainFrame');
> if isempty(ml)
>    disp('Must have desktop enabled to use mlTitle');
>    return
> end
> sp = version('-description');
>
> if ~isempty(sp)
>    switch sp(1)
>        case 'P'
>            s = ' pre';
>        case 'S'
>            s = 'sp';
>    end
>    sp = [s sp(end)];
>
> else
>    sp = '';
> end
>
> if nargin == 0
>    if isempty(getenv('MWE_VERSION'))
>        title = ['R' release sp];
>    else
>        if strfind(getenv('MWE_VERSION'),'pwd')
>            matlabpath = getenv('MATLAB');
>            slash = findstr(matlabpath,filesep);
>            matlab = findstr(matlabpath,'matlab');
>            slash = slash(slash<matlab);
>            sbver = matlabpath(slash(end-1)+1:slash(end)-1);
>            title = ['sandbox ' sbver];
>        else
>            title = getenv('MWE_VERSION');
>        end
>    end
> else
>    title = [];
>    for i=1:nargin
>        title = [title varargin{i} ' '];
>    end
> end
>
> ml.setTitle(title)
>
> 


0
no_one4609 (20)
10/20/2005 10:05:01 PM
Idin Motedayen-Aval wrote:
>
>
> No one at nowhere wrote:
>> I am working on converting some MATLAB code from version 6.5.2
to
> 7.1 and
>> often have several (up to three) versions of MATLAB running at
> the same
>> time. Each one shows up in the Windows taskbar with just the
name
> "MATLAB."
>>
>> Is there a way to have it display something like "MATLAB 7.1"
and
> "MATLAB
>> 6.5.2" so I can easily tell which version is which from just
the
> taskbar?
>>
>> Thanks,
>> Peter Neumann
>>
>
> Hi Peter,
> Save the attached M-file on your MATLAB path, and type "help
> mlTitle".
> It should do the trick for you.
>
> HTH,
> Idin Motedayen-Aval
>
>

Why not make this a default feature in MATLAB?
0
10/20/2005 11:00:04 PM
just type

a=version

and you will get the variable 'a' containing a string with the matlab
version.

german
0
10/21/2005 1:46:10 AM
Duane Hanselman wrote:
> Why not make this a default feature in MATLAB?

We will consider this enhancement request for a future release of MATLAB. 
Thanks for the feedback.

Kristin

---------------------------------------------------------
Kristin Thomas
Software Engineer
The MathWorks, Inc.
kthomas@mathworks.com
---------------------------------------------------------
0
kthomas (218)
10/21/2005 12:54:46 PM
Reply: