Comments for Undocumented Matlab https://undocumentedmatlab.com Charting Matlab's unsupported hidden underbelly Fri, 15 Dec 2017 22:08:24 +0000 hourly 1 https://wordpress.org/?v=4.4.1 Comment on Customizing contour plots part 2 by Peter Cookhttps://undocumentedmatlab.com/blog/customizing-contour-plots-part2#comment-417581 Fri, 15 Dec 2017 22:08:24 +0000 https://undocumentedmatlab.com/?p=7149#comment-417581 @Alon
This method runs very slow for a complex contour (e.g. not necessarily in size but perhaps one generated from real, noisy, data), which led me to experiment with some other methods. In the case where contour levels are specified to the function, I found a heuristic that seems to work:

[c,hContour] = contourf(imgaussfilt(noisyData,2),contourLevels);
hL = hContour.EdgePrims;
whichLevels = sum(bsxfun(@eq,c(1,:)',contourLevels)) > 10;
 
>> length(contourLevels)
ans =
    32
 
>> length(hL)
ans =
    24
 
>> length(contourLevels(whichLevels))
ans =
    24

I’m sure this might fail on some other contour plots, but it has worked on several I generated. Thoughts?

]]>
Comment on Customizing contour plots part 2 by Alonhttps://undocumentedmatlab.com/blog/customizing-contour-plots-part2#comment-417504 Wed, 13 Dec 2017 14:27:14 +0000 https://undocumentedmatlab.com/?p=7149#comment-417504 Hello Yair,
Note that if there are unused contour lines, as may be the case when hContour.LevelListMode is set to manual, the above code will not work, as hContour.EdgePrims enumerates only the visible contour lines (while not hinting at the contour level they are related to), while hContour.LevelList enumerates them all.
Instead, you must enumerate the visible contour lines:

k = 1;
activecontours = [];
while k < size(hContour.ContourMatrix,2)
    activecontours = [activecontours hContour.ContourMatrix(1,k)];
    k = k + hContour.ContourMatrix(2,k) + 1;
end
levels = unique(activecontours);

Then use the levels generated in the code you supplied.

Best regards,
Alon

]]>
Comment on HG2 update by Yair Altmanhttps://undocumentedmatlab.com/blog/hg2-update#comment-417498 Wed, 13 Dec 2017 07:39:26 +0000 http://undocumentedmatlab.com/?p=3789#comment-417498 @sipsj11 – you are very mistaken: first, the method of setting the figure’s position to [0 0 1 1] has existed forever, not just since HG2.

Secondly, this method is NOT equivalent to true maximization of the window, which is achieved by clicking the relevant icon on the top-right of the figure. For example, it ignores (overlaps) the taskbar and also shows the window borders, which a truly-maximized figure doesn’t.

]]>
Comment on HG2 update by sipsj11https://undocumentedmatlab.com/blog/hg2-update#comment-417495 Wed, 13 Dec 2017 06:01:08 +0000 http://undocumentedmatlab.com/?p=3789#comment-417495 Doesn’t need to be so complicated, in the new version of MATLAB can set the figure to full size easily by:

fig=gcf;
fig.Units='normalized';
fig.OuterPosition=[0 0 1 1];
]]>
Comment on cellfun – undocumented performance boost by Anonhttps://undocumentedmatlab.com/blog/cellfun-undocumented-performance-boost#comment-417448 Mon, 11 Dec 2017 16:07:49 +0000 http://undocumentedmatlab.com/?p=260#comment-417448 2017b

>> c = mat2cell(1:1e6,1,repmat(1,1,1e6));
>> tic, d=cellfun('isempty',c); toc
Elapsed time is 0.011489 seconds.
 
>> tic, d=cellfun(@isempty,c); toc
Elapsed time is 0.927122 seconds.
 
>> 0.927122/0.011489
ans =
   80.6965
]]>
Comment on Setting axes tick labels format by Yair Altmanhttps://undocumentedmatlab.com/blog/setting-axes-tick-labels-format#comment-417298 Wed, 06 Dec 2017 14:29:36 +0000 http://undocumentedmatlab.com/?p=2856#comment-417298 @Jim – done :-)

]]>
Comment on Setting desktop tab completions by tobiashttps://undocumentedmatlab.com/blog/setting-desktop-tab-completions#comment-417251 Mon, 04 Dec 2017 13:14:02 +0000 http://undocumentedmatlab.com/?p=1175#comment-417251 Ok, I’ve just found your “Take 2” about that topic, thanks!

]]>
Comment on Setting desktop tab completions by tobiashttps://undocumentedmatlab.com/blog/setting-desktop-tab-completions#comment-417250 Mon, 04 Dec 2017 13:04:44 +0000 http://undocumentedmatlab.com/?p=1175#comment-417250 Hi Yair,

your article saved my fingers for years now, thank you very much!

But with R2016b I cannot find TC.xml anywhere, there seems to be a new solution for tab-completion.

It can be found under “Tab key narrows completions” in the keyboard preferences and is deactivated by default. The entry in matlab.prf can be found under “CommandWindowTabNarrows=Btrue” while “CommandWindowTabCompletion” seems to be removed/replaced.

Do you have any experience with that?

Many thanks in advance!
Tobias

]]>
Comment on GUI integrated browser control by Yair Altmanhttps://undocumentedmatlab.com/blog/gui-integrated-browser-control#comment-417213 Sun, 03 Dec 2017 12:11:41 +0000 http://undocumentedmatlab.com/?p=847#comment-417213 @Nurdan –

browser.requestFocus();
]]>
Comment on CheckboxList by Yair Altmanhttps://undocumentedmatlab.com/blog/checkboxlist#comment-417212 Sun, 03 Dec 2017 11:59:04 +0000 http://undocumentedmatlab.com/?p=5012#comment-417212 @Fabrizio –

jCBList.setEnabled(false)  % or: jCBList.setEnabled(0)
]]>
Comment on Customizing uifigures part 3 by Davidhttps://undocumentedmatlab.com/blog/customizing-uifigures-part-3#comment-417152 Fri, 01 Dec 2017 08:25:04 +0000 https://undocumentedmatlab.com/?p=7169#comment-417152 Very useful resource. Once again the user community is way ahead of MathWorks developers. It’s about time they sorted out the ability to customise the appearance of individual cells in a table.

]]>
Comment on The javacomponent function by Yair Altmanhttps://undocumentedmatlab.com/blog/javacomponent#comment-417130 Thu, 30 Nov 2017 18:10:42 +0000 http://undocumentedmatlab.com/?p=1793#comment-417130 yes

]]>
Comment on The javacomponent function by Collin Pecorahttps://undocumentedmatlab.com/blog/javacomponent#comment-417129 Thu, 30 Nov 2017 18:03:59 +0000 http://undocumentedmatlab.com/?p=1793#comment-417129 Thanks Yair,

So, it would be better to use javacomponent here?

jhBut = handle(javaObjectEDT('javax.swing.JButton','Hello!'),'CallbackProperties');
jhBut.ActionPerformedCallback = @this.onAction;
 
hPanel = uipanel(...);
hgjavacomponent('Parent',hPanel','JavaPeer',jhBut,'Units','norms','Position',[0,0,1,1]);
]]>
Comment on The javacomponent function by Yair Altmanhttps://undocumentedmatlab.com/blog/javacomponent#comment-417123 Thu, 30 Nov 2017 15:18:13 +0000 http://undocumentedmatlab.com/?p=1793#comment-417123 @Collin – hgjavacomponent is a Matlab class that is meant to contain the relevant information on a contained Java-component (peer). You can think of it as a borderless panel that tightly-fits the Java peer, and enables users to set the control’s position, units etc. in a manner that is very similar to standard Matlab uipanels. Importantly, hgjavacomponent only creates this wrapper object, NOT the peer.

In contrast, javacomponent places the Java peer in the requested position, and also creates a corresponding hgjavacomponent object to provide the uipanel-like wrapper functionality. Both of these handles are returned when you call javacomponent (the java peer reference handle, followed by the hgjavacomponent container handle):

[hjControl, hContainer] = javacomponent(...)
]]>
Comment on The javacomponent function by Collin Pecorahttps://undocumentedmatlab.com/blog/javacomponent#comment-417118 Thu, 30 Nov 2017 14:44:03 +0000 http://undocumentedmatlab.com/?p=1793#comment-417118 Yair

Is there a benefit to using javcomponent over hgjavacomponent?

]]>
Comment on Setting axes tick labels format by Jim Hokansonhttps://undocumentedmatlab.com/blog/setting-axes-tick-labels-format#comment-417096 Wed, 29 Nov 2017 19:18:39 +0000 http://undocumentedmatlab.com/?p=2856#comment-417096 Yair,

Would it be possible to add an “update” section by the blurb on the listener to describe the change with HG2? I’m specifically thinking something that references MarkedClean and YRuler. I’m fine but it might be nice for others …

Thanks,
Jim

]]>
Comment on Plot markers transparency and color gradient by Yair Altmanhttps://undocumentedmatlab.com/blog/plot-markers-transparency-and-color-gradient#comment-417095 Wed, 29 Nov 2017 19:09:02 +0000 http://undocumentedmatlab.com/?p=5262#comment-417095 So try using the ScreenCapture utility. Note that it only generates bitmap sceenshots, not vectorized (PDF/EPS) ones.

]]>
Comment on Plot markers transparency and color gradient by Hassanhttps://undocumentedmatlab.com/blog/plot-markers-transparency-and-color-gradient#comment-417089 Wed, 29 Nov 2017 18:12:27 +0000 http://undocumentedmatlab.com/?p=5262#comment-417089 Thanks Yair,
Still, have the same problem. expor_fig is exporting the figure without applying the transparency to the markers. On the screen, I have a nice figure, but once exporting the figure I am loosing all. I played with the rendering options, didn’t see any change or improvement! any idea?

]]>
Comment on Plot markers transparency and color gradient by Hassanhttps://undocumentedmatlab.com/blog/plot-markers-transparency-and-color-gradient#comment-417088 Wed, 29 Nov 2017 18:11:42 +0000 http://undocumentedmatlab.com/?p=5262#comment-417088 Thanks Yair,
Still, have the same problem. expor_fig is exporting the figure without applying the transparency to the markers. On the screen, I have a nice figure, but once exporting the figure I am loosing all. I played with the rendering options, didn’t see any change or improvement! any idea?

]]>
Comment on Plot markers transparency and color gradient by Hassanhttps://undocumentedmatlab.com/blog/plot-markers-transparency-and-color-gradient#comment-417087 Wed, 29 Nov 2017 17:56:20 +0000 http://undocumentedmatlab.com/?p=5262#comment-417087 the problem is once exporting either using saveas or print functions, the transparency is not saved and gives a full normal color image! Thanks.

]]>