Comments for Undocumented Matlab Charting Matlab's unsupported hidden underbelly Tue, 21 Nov 2017 10:50:59 +0000 hourly 1 Comment on Setting listbox mouse actions by Yair Altman Tue, 21 Nov 2017 10:50:59 +0000 @Claudio – I don’t know why you posted this question here – it seems to relate to popup/dropdown menus and not listboxes. In any case, such menu items cannot be modified using the setBackground method, you need to either use a custom Java cell-renderer object, or modify the menu string to include HTML background, for example:

menuCheck.setText(sprintf('<html><body bgcolor=rgb(%d,%d,%d)>Check recording',bgcolor))
Comment on Setting listbox mouse actions by claudio Mon, 20 Nov 2017 11:22:47 +0000 Hi Yair

how can I change background color for jmenu described in the previous example?
I try

menuCheck = javax.swing.JMenuItem('Check recording');
bgcolor = get(gcf,'Color');   % background color = white 

But the classic gray background color does not change…

Comment on Customizing contour plots part 2 by Yair Altman Sat, 18 Nov 2017 15:57:20 +0000 Unlike contour, the contourf function returns a list of levels that includes the minimum value, which does not correspond to any contour line ([-6.5466,-6,-5,-4,...] rather than [-6,-5,-4,...]). So the solution for contourf is simply to equate levels(2:end) with lines, as follows:

[c,hContour] = contourf(peaks, 'LevelStep',1, 'ShowText','on'); drawnow
levels = hContour.LevelList(2:end);
lines  = hContour.EdgePrims;
set(lines(levels<0),  'LineStyle', 'dotted');
set(lines(levels==0), 'LineWidth', 2);

Comment on Customizing contour plots part 2 by Elbio Fri, 17 Nov 2017 14:16:08 +0000 Hi Yair:

Many thanks for your helpful answer. I found a problem though when using contourf.

[c,h] = contourf(peaks,'LevelStep',1); drawnow
levels = h.LevelList;
lines  = h.EdgePrims;
set(lines(levels<0),  'LineStyle', 'dotted');
set(lines(levels==0), 'LineWidth', 2);

Instead of highlighting the zero line it is the “1” line the one that appears wider.
It might be related to the different size of the levels and lines arrays. For example if I tried to change the linestyle using:

[c,h] = contourf(peaks,[-9:1:9]);
levels = h.LevelList;
lines  = h.EdgePrims;
set(lines(levels<0), 'LineStyle', 'dotted');

there are dotted lines with positive values.


Comment on Customizing contour plots part 2 by Yair Altman Fri, 17 Nov 2017 08:17:36 +0000 @Elbio – in HG2 (R2014b or newer) the contour lines (hContour.EdgePrims) correspond to the contour levels (hContour.LevelList). For example, to make all negative contour lines dotted, you can do the following:

[C,hContour] = contour(peaks, 'ShowText','on', 'LevelStep',1); drawnow
set(hContour.EdgePrims(hContour.LevelList<0), 'LineStyle', 'dotted');

I added an explanation and screenshot to the main article text above.

Comment on Customizing contour plots part 2 by Elbio Thu, 16 Nov 2017 22:02:50 +0000 Hi Yair:

Using the old matlab utilities it was possible to get the Cdata value associated with each line in the contour plot:


This utility was useful to dash the negative contours of some plot. Apparently there is no “cdata” value in the h.EdgePrims properties.

How do you think that one can proceed in order to get these values?



Comment on User-defined tab completions – take 2 by Viktor Horvath Thu, 16 Nov 2017 18:52:25 +0000 Your comment was very helpful, thank you! I would like to add to it, because to me it was not obvious that in the case of Class methods the first argument must be declared in the functionSignatures.json with the proper type otherwise it will not work. For example:

classdef foo
        function out = bar(obj, arg)
            out = arg;

In order to have tab completion for the bar() method the corresponding functionSignatures.json file must contain the following.


Note the first entry in the input list is the object itself which can be used to generate options on the fly as shown in the article.

Comment on treeTable by Yair Altman Thu, 16 Nov 2017 15:31:41 +0000 @Daniele – I will answer you in an offline email

Comment on treeTable by Daniele F. Thu, 16 Nov 2017 15:12:48 +0000 Dear Yair

I’m happily using your treeTable utility, thanks again to making it available.
I’ve a question:
I’ve compiled an application that uses the treeTable function. When I start the compiled application I receive the message:
“Unauthorized usage of JIDE products
You get this message box is because you didn’t input a correct license key. …”
Where do I have to insert the licence key to avoid this message? And which is the minimum purchase that I should buy in order to use the treeTable utility, if I have to? (

Thanks in advance

Comment on GUI automation using a Robot by Joshua Tue, 14 Nov 2017 03:47:23 +0000 Hi, is there a way to simulate the keyboard input using the robot when the robot encounters user input request generated? For example,

a = input('Type a word: ', 's');

This is for the purpose of testing the interactive feature of a program. Is it possible?


Comment on Sending HTML emails from Matlab by matlabi Mon, 13 Nov 2017 23:05:22 +0000 hi
Smtp settings Where should we place?

Comment on Animated busy (spinning) icon by Yair Altman Mon, 13 Nov 2017 14:47:22 +0000 @Ben – I am not aware of any way to set multi-line text in the BusyAffordance object

Comment on Animated busy (spinning) icon by BenBen Mon, 13 Nov 2017 14:14:59 +0000 Is there a way to get multiple text lines in the jObj.setBusyText? Thanks !

Comment on Simulink Data Dictionary by Donn Fri, 10 Nov 2017 15:07:22 +0000 I would need more information to help you. Simulink Data Dictionary files (.sldd) files are covered in many places. What is the format of the Data dictionary files (.dd) you are referring to?

Comment on Fixing a Java focus problem by Temu Wed, 08 Nov 2017 13:40:05 +0000 Hi Yair,

Thanks for sharing all these insights! These are really helpful.

I am currently trying to implement a focus-follows-mouse mechanism in matlab, since versions from (at least) 2015a onwards no longer support this behaviour. I have sommething that sometimes works, but not always, and I am at a loss here. I am hoping you have some ideas. I have tried the following:

function focus()
    mde = com.mathworks.mde.desk.MLDesktop.getInstance;
    cw = mde.getClient('Command Window');
    xCmdWndView = cw.getComponent(0).getViewport.getComponent(0);
    h_cw = handle(xCmdWndView,'CallbackProperties');
    function callMe(varargin)
        desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
        desktop.getMainFrame.setFocusable(true);       % This one doesn't always work
        desktop.getMainFrame.requestFocusInWindow();   % This one doesn't always work
    set(h_cw, 'MouseEnteredCallback', @callMe);

This often works, but when I, e.g., click the windows desktop first (at an empty space), only the icon in my taskbar becomes blue, but the matlab desktop does not focus. When I come from a different window, it seems to work most of the times.

I hope you can help me with this,


Comment on Simulink Data Dictionary by Amit kumar Tue, 07 Nov 2017 07:16:41 +0000 Can anybody tell me that how i can import .dd (Data dictionary) file in MATLAB and then import the properties of dd file to matlab?

Comment on Editable combo-box by Amit Mon, 06 Nov 2017 15:44:46 +0000 Hi Yair,

How can I use JIDE’s DateComboBox as the celleditor for a column in a jide table? So basically a table column having a combobox dropdown as a date selector(calendar), I have set the column class as date and made it to accept different date formats, but couldn’t get calendar dropdown to work in a table.


Comment on Customizing menu items part 3 by Yair Altman Mon, 06 Nov 2017 09:37:55 +0000 @Sneha – add a short drawnow; pause(0.01) between the calls to jFileMenu.doClick and the call to jFileMenu.getMenuComponent.

More information:

Comment on Customizing uifigures part 1 by HL SHI Sun, 05 Nov 2017 15:21:25 +0000 Dear Davide Miani,

According to your update, I can change the ico to my own ico file by:

win.Icon = 'D:\working\SoftwareCopyright\making\ms\ERP_Pre\tosong\erp.ico';

But I find it did not work when I added the following code to function startupFcn(app)

        % Code that executes after component creation
        function startupFcn(app)
            figProps = struct(app.UIFigureERP);         
            controller = figProps.Controller;
            controllerProps = struct(controller);
            platformHost = controllerProps.PlatformHost;
            platformHostProps = struct(platformHost);
            win = platformHostProps.CEF;
            win.Icon = 'D:\working\SoftwareCopyright\making\ms\ERP_Pre\tosong\erp.ico';
Comment on Undocumented Profiler options part 3 by juli Fri, 03 Nov 2017 08:09:14 +0000 hi Yair,

thanks I have readed and tried but in my case the code evaluated has 156 levels and is very slow to represent the figure and to see the diferent levels.