Comments for Undocumented Matlab https://undocumentedmatlab.com Charting Matlab's unsupported hidden underbelly Tue, 21 Nov 2017 10:50:59 +0000 hourly 1 https://wordpress.org/?v=4.4.1 Comment on Setting listbox mouse actions by Yair Altmanhttps://undocumentedmatlab.com/blog/setting-listbox-mouse-actions#comment-416718 Tue, 21 Nov 2017 10:50:59 +0000 http://undocumentedmatlab.com/?p=503#comment-416718 @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 claudiohttps://undocumentedmatlab.com/blog/setting-listbox-mouse-actions#comment-416680 Mon, 20 Nov 2017 11:22:47 +0000 http://undocumentedmatlab.com/?p=503#comment-416680 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 
menuCheck.setBackground(java.awt.Color(bgcolor(1),bgcolor(2),bgcolor(3)));
menuCheck.repaint

But the classic gray background color does not change…

]]>
Comment on Customizing contour plots part 2 by Yair Altmanhttps://undocumentedmatlab.com/blog/customizing-contour-plots-part2#comment-416609 Sat, 18 Nov 2017 15:57:20 +0000 https://undocumentedmatlab.com/?p=7149#comment-416609 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 Elbiohttps://undocumentedmatlab.com/blog/customizing-contour-plots-part2#comment-416561 Fri, 17 Nov 2017 14:16:08 +0000 https://undocumentedmatlab.com/?p=7149#comment-416561 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.

Regards,
Elbio.

]]>
Comment on Customizing contour plots part 2 by Yair Altmanhttps://undocumentedmatlab.com/blog/customizing-contour-plots-part2#comment-416543 Fri, 17 Nov 2017 08:17:36 +0000 https://undocumentedmatlab.com/?p=7149#comment-416543 @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 Elbiohttps://undocumentedmatlab.com/blog/customizing-contour-plots-part2#comment-416528 Thu, 16 Nov 2017 22:02:50 +0000 https://undocumentedmatlab.com/?p=7149#comment-416528 Hi Yair:

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

[c,h]=contourf(peaks,[-9:1:9]);
h1=get(h,'children');
hdd=get(h1(1),'Cdata');
 
hdd=8

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?

Regards,

Elbio

]]>
Comment on User-defined tab completions – take 2 by Viktor Horvathhttps://undocumentedmatlab.com/blog/user-defined-tab-completions-take-2#comment-416520 Thu, 16 Nov 2017 18:52:25 +0000 http://undocumentedmatlab.com/?p=6961#comment-416520 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
    methods
        function out = bar(obj, arg)
            out = arg;
        end
    end
end

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

{
    "foo.bar":
    {
        "inputs":
        [
            {"name":"obj","kind":"required","type":"foo"},
            {"name":"arg","kind":"required","type":"choices={'choice1','choice2'}"}
        ]
    }
}

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 Altmanhttps://undocumentedmatlab.com/blog/treetable#comment-416507 Thu, 16 Nov 2017 15:31:41 +0000 http://undocumentedmatlab.com/?p=4062#comment-416507 @Daniele – I will answer you in an offline email

]]>
Comment on treeTable by Daniele F.https://undocumentedmatlab.com/blog/treetable#comment-416505 Thu, 16 Nov 2017 15:12:48 +0000 http://undocumentedmatlab.com/?p=4062#comment-416505 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? (http://www.jidesoft.com/purchase/order.htm)

Thanks in advance

]]>
Comment on GUI automation using a Robot by Joshuahttps://undocumentedmatlab.com/blog/gui-automation-robot#comment-416397 Tue, 14 Nov 2017 03:47:23 +0000 http://undocumentedmatlab.com/?p=1815#comment-416397 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?

Thanks!

]]>
Comment on Sending HTML emails from Matlab by matlabihttps://undocumentedmatlab.com/blog/sending-html-emails-from-matlab#comment-416388 Mon, 13 Nov 2017 23:05:22 +0000 http://undocumentedmatlab.com/?p=6986#comment-416388 hi
Smtp settings Where should we place?

]]>
Comment on Animated busy (spinning) icon by Yair Altmanhttps://undocumentedmatlab.com/blog/animated-busy-spinning-icon#comment-416373 Mon, 13 Nov 2017 14:47:22 +0000 http://undocumentedmatlab.com/?p=4769#comment-416373 @Ben – I am not aware of any way to set multi-line text in the BusyAffordance object

]]>
Comment on Animated busy (spinning) icon by BenBenhttps://undocumentedmatlab.com/blog/animated-busy-spinning-icon#comment-416371 Mon, 13 Nov 2017 14:14:59 +0000 http://undocumentedmatlab.com/?p=4769#comment-416371 Is there a way to get multiple text lines in the jObj.setBusyText? Thanks !

]]>
Comment on Simulink Data Dictionary by Donnhttps://undocumentedmatlab.com/blog/simulink-data-dictionary#comment-416247 Fri, 10 Nov 2017 15:07:22 +0000 http://undocumentedmatlab.com/?p=5571#comment-416247 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 Temuhttps://undocumentedmatlab.com/blog/fixing-a-java-focus-problem#comment-416178 Wed, 08 Nov 2017 13:40:05 +0000 http://undocumentedmatlab.com/?p=1933#comment-416178 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
    end
 
    set(h_cw, 'MouseEnteredCallback', @callMe);
end

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,

Temu

]]>
Comment on Simulink Data Dictionary by Amit kumarhttps://undocumentedmatlab.com/blog/simulink-data-dictionary#comment-416133 Tue, 07 Nov 2017 07:16:41 +0000 http://undocumentedmatlab.com/?p=5571#comment-416133 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 Amithttps://undocumentedmatlab.com/blog/editable-combo-box#comment-416109 Mon, 06 Nov 2017 15:44:46 +0000 http://undocumentedmatlab.com/?p=4246#comment-416109 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.

Thanks,
Amit

]]>
Comment on Customizing menu items part 3 by Yair Altmanhttps://undocumentedmatlab.com/blog/customizing-menu-items-part-3#comment-416101 Mon, 06 Nov 2017 09:37:55 +0000 http://undocumentedmatlab.com/?p=2909#comment-416101 @Sneha – add a short drawnow; pause(0.01) between the calls to jFileMenu.doClick and the call to jFileMenu.getMenuComponent.

More information:
* https://undocumentedmatlab.com/blog/matlab-and-the-event-dispatch-thread-edt
* https://undocumentedmatlab.com/blog/solving-a-matlab-hang-problem

]]>
Comment on Customizing uifigures part 1 by HL SHIhttps://undocumentedmatlab.com/blog/customizing-uifigures-part-1#comment-416062 Sun, 05 Nov 2017 15:21:25 +0000 http://undocumentedmatlab.com/?p=6554#comment-416062 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';
        end
]]>
Comment on Undocumented Profiler options part 3 by julihttps://undocumentedmatlab.com/blog/undocumented-profiler-options-part-3#comment-415972 Fri, 03 Nov 2017 08:09:14 +0000 http://undocumentedmatlab.com/?p=3158#comment-415972 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.

regards,
j

]]>