Comments for Undocumented Matlab https://undocumentedmatlab.com Charting Matlab's unsupported hidden underbelly Mon, 22 Apr 2019 01:06:47 +0000 hourly 1 https://wordpress.org/?v=4.4.1 Comment on Multi-threaded Mex by Hosseinhttps://undocumentedmatlab.com/blog/multi-threaded-mex#comment-475893 Mon, 22 Apr 2019 01:06:47 +0000 https://undocumentedmatlab.com/?p=7771#comment-475893 Hi,

I changed the size of matrices from 4 to 10000, i.e. matrix1=rand(10000) and matrix2=rand(10000);
Then, I compared the speed in terms of the number of the threads.
For Nthreads=1 and Nthreads=4 the runtime is almost the same!!! I do not know why?!?!

]]>
Comment on Matlab toolstrip – part 9 (popup figures) by Arash Marashianhttps://undocumentedmatlab.com/blog/matlab-toolstrip-part-9-popup-figures#comment-475426 Wed, 17 Apr 2019 16:40:18 +0000 https://undocumentedmatlab.com/?p=8402#comment-475426 Hi,
Dear Yair, Thank you for your information.
I have a question in “showcaseMPCDesigner.m”, we have a function named “createDialog”, that makes a local popup.
I want to make sth like that, so it has 10 text-fields with a label and has a callback function.
At first, I can’t make more than 3 text-fields, and second of all, I can’t make a callback function.

I’ll be glad if you can help me.

]]>
Comment on Matlab toolstrip – part 5 (icons) by Arash Marashianhttps://undocumentedmatlab.com/blog/matlab-toolstrip-part-5-icons#comment-474435 Fri, 12 Apr 2019 16:59:21 +0000 https://undocumentedmatlab.com/?p=8188#comment-474435 Problem Solved.

I found out that my version does not have this icon.

thanks.

]]>
Comment on Matlab toolstrip – part 5 (icons) by Arash Marashianhttps://undocumentedmatlab.com/blog/matlab-toolstrip-part-5-icons#comment-474433 Fri, 12 Apr 2019 16:47:04 +0000 https://undocumentedmatlab.com/?p=8188#comment-474433 Hi,
Dear Yair when I’m using PLOT_16 icon MATLAB gives me an error as below:
The class matlab.ui.internal.toolstrip.Icon has no Constant property or Static method named 'PLOT_16'.

What should I do?

]]>
Comment on Uitable customization report by Rezahttps://undocumentedmatlab.com/blog/uitable-customization-report#comment-474299 Fri, 12 Apr 2019 01:21:31 +0000 http://undocumentedmatlab.com/?p=2396#comment-474299 The reason is that matlab look to every field as text value.
I think you must use from main Java table… “com.jidesoft.grid.SortableTable”

]]>
Comment on Customizing contour plots by Austin Spencerhttps://undocumentedmatlab.com/blog/customizing-contour-plots#comment-474219 Thu, 11 Apr 2019 14:26:11 +0000 http://undocumentedmatlab.com/?p=6075#comment-474219 An update/correction after some additional exploration: EdgePrims is still used for contour lines that do not form closed loops, as is the case when a contour line intersects the edge of the dataset. Therefore, in order to set the properties of all contours consistently, you must loop over all EdgePrims and EdgeLoopPrims.

]]>
Comment on Interesting Matlab puzzle – analysis by Marshallhttps://undocumentedmatlab.com/blog/interesting-matlab-puzzle-analysis#comment-474216 Thu, 11 Apr 2019 13:58:47 +0000 https://undocumentedmatlab.com/?p=8664#comment-474216 This was a fun puzzle–don’t hesitate to add more posts like these if you come across some other fun ones!

]]>
Comment on GUI integrated browser control by Rezahttps://undocumentedmatlab.com/blog/gui-integrated-browser-control#comment-474166 Thu, 11 Apr 2019 07:32:36 +0000 http://undocumentedmatlab.com/?p=847#comment-474166 I have the same problem. this Java widget got error in compiling via Matlab 2018!
Could you please show me how to solve this?

]]>
Comment on Reverting axes controls in figure toolbar by Danihttps://undocumentedmatlab.com/blog/reverting-axes-controls-in-figure-toolbar#comment-473977 Wed, 10 Apr 2019 09:37:47 +0000 https://undocumentedmatlab.com/?p=8171#comment-473977 I actually really like how we can interact with plots in 2018b and 2019a. I often develop GUIs for end-users and deactivate the standard Matlab figure toolbar all together (opposite to most other people that now miss part of the standard figure toolbar). Problem in my case is that I don’t get the default axes interactions unless I do things in the right order, i.e. I have run enableDefaultInteractivity after something is plotted in the axes otherwise data tips etc. are not active, see below. I don’t know why and I did not find this documented anywhere.

h_f = figure('toolbar', 'none');
h_ax = axes;
enableDefaultInteractivity(h_ax); % No effect
plot(magic(10)) 
enableDefaultInteractivity(h_ax); % This does the trick
tb = axtoolbar(h_ax, 'default'); 
tb.Visible = 'on';

There are other issues with going all-in with regard to the new possibilities that Matlab offers in 2019a. For example

1. Why do pcolor objects not come with a DataTipTemplate? plot does, even surf does. Makes it difficult to develop applications that have a consistent user interaction.

2. The DataTipTemplate gives nice possibilities to improve data exploration. But when I assign them to all the objects on my GUIs the plot/refresh times are doubled. The performance of Matlab is crucial for most of us. So, please only introduce features once it is clear that they do not affect performance significantly. It is not fair to us users to introduce these features and we then rewrite code just to figure out in the end that we just created a snail and wasted lots of our development time.

So, please Mathworks:
– document better
– make things consistent
– check performance before releasing new features
(and why we in 2019 still have to beg that you introduce export to clipboard – axtoolbar, as already stated by Yair above – is not understandable)

]]>
Comment on Matlab toolstrip – part 3 (basic customization) by Endri K.https://undocumentedmatlab.com/blog/matlab-toolstrip-part-3-basic-customization#comment-473870 Tue, 09 Apr 2019 21:36:24 +0000 https://undocumentedmatlab.com/?p=8077#comment-473870 Hi Yair,

Thank you for all your great posts. They’re all extremely helpful. Could you please help me with an issue I’m facing? I’ve built an application with a ToolGroup and when using the Matlab Application Compiler, in the compiled standalone version, I cannot get hToolGroup.addFigure to dock a new figure in the existing ToolGroup window. I have tried a number of approaches and have been unsuccessful. For this application I am currently using Matlab 2017b.

Thank you,
Endri

]]>
Comment on Customizing contour plots by Austin Spencerhttps://undocumentedmatlab.com/blog/customizing-contour-plots#comment-473847 Tue, 09 Apr 2019 18:31:35 +0000 http://undocumentedmatlab.com/?p=6075#comment-473847 As of at least MATLAB R2018b, the names of some undocumented contour properties have changed. The edges are now listed under EdgeLoopPrims and are of type LineLoop. EdgePrims is still present, but is empty. LineLoop has ColorData and ColorType properties, so the same customization is still possible.

]]>
Comment on Another couple of Matlab bugs and workarounds by Yair Altmanhttps://undocumentedmatlab.com/blog/couple-of-matlab-bugs-and-workarounds#comment-473820 Tue, 09 Apr 2019 14:25:16 +0000 http://undocumentedmatlab.com/?p=5272#comment-473820 Typo corrected, meant ASCII of course (ASCII is represented by 1 byte in UTF-8, and 2 bytes in UTF-16)

]]>
Comment on Another couple of Matlab bugs and workarounds by GGahttps://undocumentedmatlab.com/blog/couple-of-matlab-bugs-and-workarounds#comment-473814 Tue, 09 Apr 2019 13:41:27 +0000 http://undocumentedmatlab.com/?p=5272#comment-473814 There isn’t anything “outside the UTF-8 range”.
UTF-8 can represent any Unicode character, as far as I know.

]]>
Comment on Plot markers transparency and color gradient by Yair Altmanhttps://undocumentedmatlab.com/blog/plot-markers-transparency-and-color-gradient#comment-473658 Mon, 08 Apr 2019 23:09:18 +0000 http://undocumentedmatlab.com/?p=5262#comment-473658 Of course it still works. Did I ever say “h.FaceColorData” (where h is the plot return handle) anywhere in my post? Read the post text carefully and try the code snippets one by one.

]]>
Comment on Plot markers transparency and color gradient by Wolfganghttps://undocumentedmatlab.com/blog/plot-markers-transparency-and-color-gradient#comment-473641 Mon, 08 Apr 2019 21:57:04 +0000 http://undocumentedmatlab.com/?p=5262#comment-473641 any hint on how this works with r2018b and beyond?
I was just trying this on a plot and get:

h = plot(1:1:5, 'bo');
h.FaceColorData
No appropriate method, property, or field 'FaceColorData' for
class 'matlab.graphics.chart.primitive.Line'.

so I guess this ‘hack’ doesn’t work anymore. Is there a new way?

]]>
Comment on Interesting Matlab puzzle by Brad Stiritzhttps://undocumentedmatlab.com/blog/interesting-matlab-puzzle#comment-473457 Mon, 08 Apr 2019 02:00:09 +0000 https://undocumentedmatlab.com/?p=8614#comment-473457 Hi Yair, I would expect the conditional expression to fail during parsing, and therefore lead to “Doo!” output per catch block. The proper “functional” syntax for logical OR is as follows:

>> or(false,true)
ans =
  logical
   1
]]>
Comment on Interesting Matlab puzzle by Marshallhttps://undocumentedmatlab.com/blog/interesting-matlab-puzzle#comment-472724 Thu, 04 Apr 2019 17:39:28 +0000 https://undocumentedmatlab.com/?p=8614#comment-472724 (I meant variant #5)

]]>
Comment on Interesting Matlab puzzle by Marshallhttps://undocumentedmatlab.com/blog/interesting-matlab-puzzle#comment-472722 Thu, 04 Apr 2019 17:38:40 +0000 https://undocumentedmatlab.com/?p=8614#comment-472722 Ha, it looks like variant #4 got me. Quite clever. When pasted in Matlab it’s a bit more obvious because the “10< 9.9" is coded purple, indicating character arrays.

]]>
Comment on Interesting Matlab puzzle by Marshallhttps://undocumentedmatlab.com/blog/interesting-matlab-puzzle#comment-472721 Thu, 04 Apr 2019 17:35:38 +0000 https://undocumentedmatlab.com/?p=8614#comment-472721 It looks like this is just syntax muddling. Rewritten with better formatting, we get this:

function test
    try
        if(false)
            or(true);
            disp('Yaba');
        else
            disp('Daba');
        end
    catch
        disp('Doo!');
    end
end

We never actually reach the line “or(true)”, which would throw an error, causing the catch block to print ‘Doo!’, so instead we simply print ‘Daba’. The parentheses are required in order to have the (false) alone apply to the if statement, as opposed to what comes after.

Regarding the other questions:

if (false) or (true) % variant #1
if (true) or (false) % variant #2 — my guess is this will print ‘Doo!’, since the or(false) will throw an error
if (true) or (10< 9.9) % variant #3 — will also print ‘Doo!’ for the same reason: “or(10<9.9)” is invalid
if true or 10< 9.9 % variant #4 — will also print ‘Doo!’, but this time it’s because “true or 10< 9.9” or: “10>9.9 or 10<9.9” is invalid — the or function requires 2 arguments

]]>
Comment on Interesting Matlab puzzle by Michelle Hirschhttps://undocumentedmatlab.com/blog/interesting-matlab-puzzle#comment-472001 Mon, 01 Apr 2019 15:57:49 +0000 https://undocumentedmatlab.com/?p=8614#comment-472001 Is it cheating if I not only work at MathWorks, but asked the development lead for the MATLAB Front End and Code Analyzer for an answer? Andrew emailed me the same puzzle over the weekend, which I forwarded on to the dev lead. Here’s the scoop:

For backwards compatibility, space is a valid separator between the expression in the if-condition and the first statement in the body. We don’t want to encourage users to write more such code because we realize this can be very confusing, but we also don’t want to break existing code which is out there and works correctly.

Therefore, the Code Analyzer tries to provide an indication of the current behavior and direct users away from it. For this specific code example, it provides these two messages on the “or” in the MATLAB Editor:

This statement (and possibly following ones) cannot be reached.
Consider using newline, semicolon, or comma before this statement for readability.

]]>