Comments for Undocumented Matlab Charting Matlab's unsupported hidden underbelly Mon, 19 Feb 2018 21:36:50 +0000 hourly 1 Comment on Adding custom properties to GUI objects by Yaroslav Mon, 19 Feb 2018 21:36:50 +0000 Hi Yair,

Kudos for bringing up this Sealed issue; I couldn’t have agreed with you more. It is indeed a perplexing decision that hampers one’s work.

I have first encountered this problem while updating the old Cursorbar to the new HG2 engine. Since Cursorbar needed — on top of a plethora of new properties — events and methods with arguments, and since it had to be “real time,” the simple solution of addprop just wouldn’t suffice. It would have been much easier to subclass either Group or some other handle graphics class; alas, being not the case, I had to wiggle myself around to keep the desired behavior and compatibility with handle graphics. As you can imagine, it came with some cost, and some things still don’t work properly as a result.

I believe the Matlab community should press strongly on this matter. Maybe, a shared “new functionality” request between many people or a petition of some sort will do the trick. In any case, it would help to hear a clarification from Mathworks about this decision; perhaps, they have some reasons we’re unaware of.

Cheers and keep up the good work.

Comment on Explicit multi-threading in Matlab part 1 by Peyman Sun, 18 Feb 2018 20:33:39 +0000 Thanks Yair. Clearing java solved the problem.

Comment on Explicit multi-threading in Matlab part 1 by Yair Altman Sat, 17 Feb 2018 17:05:38 +0000 @Peyman – it’s probably due to one of the possible reasons that I listed here:

Comment on JMI – Java-to-Matlab Interface by Yair Altman Sat, 17 Feb 2018 17:00:48 +0000 @Andrew – I fixed the MatlabControl link to its new home on GitHub

Comment on Explicit multi-threading in Matlab part 1 by Peyman Fri, 16 Feb 2018 23:34:20 +0000 Mybe important: I’m using matlab R2008a and jdk 1.6.0 (both matlab and compilation)

Comment on Explicit multi-threading in Matlab part 1 by Peyman Fri, 16 Feb 2018 23:29:29 +0000 Thank you for the post. It seems to be the exact solution I was looging for but I cannot start the Thread like you showed above. I get the error message:

??? Undefined function or method 'start' for input arguments of type 'ParallelPortReaderThread'.
Error in ==> testThread at 8

This is my Matlab code:

import java.lang.Thread;
import java.util.LinkedList;
rr_intervals = LinkedList();
for i = 1:10
javaaddpath 'C:\Documents and Settings\user\My Documents\MATLAB\Marieke_Experiment';
%ParallelPortReaderThread pThr = new ParallelPortReaderThread(rr_intervals);

And this my java class:

import java.util.Random;
import java.util.LinkedList;
import java.lang.Thread;
public class ParallelPortReaderThread extends Thread {
    private LinkedList rrIntervals;
    public ParallelPortReaderThread(LinkedList queue) {
        this.rrIntervals = queue;
    public void run() {
        Random random = new Random();
        long x = (long) (800 + 200 * random.nextFloat());
	try {
        } catch (InterruptedException ie) {
    public LinkedList getRrIntervals() {
        return rrIntervals;

I’d be very thankful about any help and/or advice

Comment on JMI – Java-to-Matlab Interface by Andrew Janke Thu, 15 Feb 2018 18:03:50 +0000 Very useful post! I’ll be using this in one of my current projects.

BTW, it looks like the “MatlabControl” link in the fifth paragraph is broken. It’s pointing to, which is defunct. Could you update the link to MatlabControl’s current home?

Comment on Uitab customizations by Yair Altman Mon, 12 Feb 2018 17:36:30 +0000 @Eric – of course, you can use HTML, much as for uitables (as I explained here)

uitab('Title','<html>Line #1<br/>Line #2')

Add a <center> tag if you want the tab label to be centered:

uitab('Title','<html><center>Line #1<br/>Line #2')
Comment on Uitab customizations by Eric Alexander Mon, 12 Feb 2018 16:41:16 +0000 Yair,

Do you know of any means to create a uitab with two lines of text that are on top of one another. Uitab does not accept cell arrays when called the “Title” property i.e. uitab(‘Title’,{‘Cat’;’Dog’}) gives an error. Even when doing uitab(‘Title’,[‘Cat’;’Dog’]) creates a tab with the title ‘CDaotg’ for some reason. Any insight would be helpful.


Comment on Uitable cell colors by Bryan Wed, 07 Feb 2018 21:20:57 +0000 While I certainly respect Yair’s need to be compensated for his time, I thought it would be worth mentioning what I came up with. I actually linked over to undocumentedmatlab from a post on Mathworks where Yair suggested this page as a solution to a question:

Staff member Friedrich’s solution is what I ended up working from. Essentially Matlab UITables natively support html code in each cell, so you can do literally anything you could imagine with that if you do a bit of googling on html tables and formatting. Works like a charm, but it can be very slow in rendering if you have a large table. My table has 13 columns and scrolling down to the bottom of 5000 entries took Matlab nearly 3 whole minutes to catch up rendering. Yair’s solution using a Java renderer is absolutely faster, but it has quite a few issues in more recent versions of Matlab. I experienced random table shading, java console errors on mouse-over, cell text all becoming grey, and so on when I tried to implement the code listed above in R2016a.

Hope this helps,

Comment on COM/ActiveX tips & tricks by Yair Altman Wed, 07 Feb 2018 20:05:10 +0000 @Gary – MathWorks constantly change their website without bothering to redirect the old webpages to their new URLs. This is yet another example of this. I fixed the link that you mentioned to the new URL (hopefully it will not be changed again in the near future, but who know). Unfortunately, all the other links in the article that lead to MathWorks webpage are also broken, and I have not fixed them. If anyone has time to search for the new URLs and email me, then I will update them.

Comment on IP address input control by Peter Cook Wed, 07 Feb 2018 18:32:36 +0000 A quick method to check if a machine is connected to a particular IP address using MATLAB, which is a potentially useful callback for a widget like this (after string verified with IPTextField):

%check to see if user is on corporate ethernet and terminate otherwise
[~,dosReply] = dos('ping');
[~,~,noPacket] = regexp(dosReply,'Received = \d','match');
noPacket = str2double(dosReply(noPacket));
if lt(noPacket,2)
    uiwait(errordlg('Must be Connected to Secure Network'))
Comment on COM/ActiveX tips & tricks by Gary Roth Tue, 06 Feb 2018 19:23:58 +0000 I tried to follow the “well documented” link ( and received the message “The page you were looking for does not exist. Use the search box or browse topics below to find the page you were looking for.”

Comment on Additional license data by Andrew Tue, 06 Feb 2018 17:00:27 +0000 Is there any way to return a floating toolbox license without closing the Matlab session? Its not uncommon for me to find that somewhere in my code base I accessed an obscure toolbox which another user now wants to use. At present the only way to that I know of to release the license is to stop what I am doing and shut down Matlab.

Comment on Adding a context-menu to a uitree by Yair Altman Tue, 06 Feb 2018 09:20:10 +0000 @Ian – try to call the Java object’s repaint() method (function), after adding it to the panel (presumably using a call to javacomponent)

Comment on Uitable cell colors by Yair Altman Tue, 06 Feb 2018 09:16:10 +0000 @Martin – as stated in my response to Bryan, I do not work for free: goodwill does not go very far when I need to pay for the groceries and utilities, so I would like to be compensated for my time and expertise. And surely you cannot expect that if Bryan (or anyone else) paid me for a private consulting, that I will just post it here for anyone to see – private consulting remains private.

If this problem affects your professional work, then surely your employer can see the value in paying for a professional solution. You can contact me by email (altmany at or my consulting page.

Comment on Uitable cell colors by Martin Tue, 06 Feb 2018 07:19:33 +0000 Hi Bryan, Hi Yair,
I’ve the same problem and would also be very glad to get it running! So please post the solution online and not direct via email to Bryan.
Thanks, regards

Comment on Solving an mput (FTP) hang problem by Enes Tue, 06 Feb 2018 05:53:34 +0000 I was facing the same problem. When I used dir(f) command the code would just get stuck. Using the line: “sf=struct(f); sf.jobject.enterLocalPassiveMode();” to switch to passive mode as you have pointed out solved my problem. Thank you.

Comment on Adding a context-menu to a uitree by Ian Alan Tue, 06 Feb 2018 04:29:45 +0000 Yair,

I am trying to create a uitree one a resizable panel created with your uisplitpane() function.

The tree won’t show up at all in the figure until I drag the divider around with the mouse to resize the panes, and then it shows up like it should. Do you have any suggestions on how I could fix this?

I am using MATLAB 2011a, if it matters.

Comment on Matlab and the Event Dispatch Thread (EDT) by Jim Hokanson Mon, 05 Feb 2018 04:46:43 +0000 Hi Yair,

I’m interested in the last little bit on the callbackOnEDTQueue() function at the end. In testing this seems to solve my problem of trying to delay running a computation until some later point in time, allowing the rest of the axes to render following a xlim change.

This seems like an alternative to the following post:

Where my general use case would be to call the notify event (in the linked blog post) directly from Matlab: i.e. evt.notifyMyTest rather than from Java as the linked post is really about.

Am I understanding the callbackOnEDTQueue() function correctly, that it appears to serve the same functionality as the evt class in the link, without the need for writing a Java class and adding it to the Matlab path?

I guess I am confused by this statement:

%Note that the function is still executing on the main Matlab thread. This
%function just delays when it will be called.

What are the practical implications of that statement?

Thanks as always,