Comments for Undocumented Matlab Charting Matlab's unsupported hidden underbelly Thu, 20 Jul 2017 09:26:19 +0000 hourly 1 Comment on Customizing menu items part 3 by Yair Altman Thu, 20 Jul 2017 09:26:19 +0000 @Sneha – as I explained here, the menu needs to be opened once in order for its menu items to become visible.

Comment on Customizing menu items part 3 by Sneha Thu, 20 Jul 2017 09:11:38 +0000 Hi Yair,
The article is very helpful.
I tried to execute the commands in a single m-file programatically but got an error.
The error occurred was

Java exception occurred:
java.lang.ArrayIndexOutOfBoundsException: No such child: 0
	at java.awt.Container.getComponent(Unknown Source)
	at javax.swing.JMenu.getMenuComponent(Unknown Source)

if I execute the code one line at a time I did not face any issue .
Could you please help me with the issue

Comment on TODO by Yair Altman Thu, 20 Jul 2017 06:30:30 +0000 Try it in R2017b :-)

Comment on Customizing Matlab uipanels by OrO Thu, 20 Jul 2017 01:56:09 +0000 It helps a lot. Thank you !
Does it work in MATLAB Compiler ? I do not see a reason why it should not but I would like to have your confirmation.

Comment on TODO by D Brien Wed, 19 Jul 2017 22:24:49 +0000 I am experimenting with this now. You need to change your java version to 1.8+, which requires setting the environment variable. It doesn’t appear that this breaks anything as far as I’ve seen, but officially even MATLAB 2017a still is on 1.7, which is too bad. You will also need to set up your static classpath to include the jfxrt.jar and any custom functions you will end up using.

From there a JFXPanel will initialize the JavaFX toolkit and you can add a scene and all of the JavaFx functions work fine. You will need to use Yair’s method for sending event notices if you wish to communicate with MATLAB. This is nice though because you can actually use css to skin the look of the GUI. It seems like possible the best option for creating fully customizable GUIs in MATLAB.

The set up is the biggest pain I’ve found is the set up and changing the native java version. Not all clients will want to do that.

Comment on Real-time trading system demo by Leonel Tue, 18 Jul 2017 19:13:23 +0000 Hi Yair,
Could you please contact me, I have a question regarding a similar application



Comment on User-defined tab completions – take 2 by Sky Sartorius Sun, 16 Jul 2017 22:00:11 +0000 This is a post I have been waiting for, Yair. Thank you. I was spending too much time digging through the Matlab functionSignatures.json files to find examples similar to what I was trying to do, so this summary is an excellent resource.

Comment on Images in Matlab uicontrols & labels by Yair Altman Sun, 16 Jul 2017 16:27:39 +0000 @Ronit – you can update the button’s CData property. Read the Matlab documentation for the uicontrol function for details/examples.

Comment on Images in Matlab uicontrols & labels by Ronit Sun, 16 Jul 2017 07:39:00 +0000 Do you know a way to show images on push buttons via GUIDE?
Thanks in advance!

Comment on Waiting for asynchronous events by Brian Sun, 16 Jul 2017 04:10:39 +0000 Hey I know this is a rather old post, but I wanted to post my solution just in case anyone from the future has the same question. It turns out you can call back into Matlab via JMI to poll the keyboard event queue and trigger an exception if a “Ctrl-C” is waiting. I wrote this up in more detail on my blog at Let me know what you think.

Comment on The javacomponent function by Yair Altman Sat, 15 Jul 2017 21:16:25 +0000 @Anu – this sounds like a bug in your code. Errors are not supposed to happen.

Comment on Customizing contour plots part 2 by Yair Altman Sat, 15 Jul 2017 21:13:27 +0000 @Ricardo – I don’t quite understand what you need. In general, if you want to change the action of the slider then simply update its callback function:

cbFunc = @(hSlider,evtData) set(hContour,'ContourZLevel',hSlider.getValue/100*zrange+zmin);
Comment on User-defined tab completions – take 2 by Greg Thu, 13 Jul 2017 16:48:09 +0000 Thanks, Yair, this is awesome!

One added detail that I discovered when implementing this feature this morning is where MATLAB expects the .json file and the appropriate syntax for functions in package folders (i.e. +directories).

It looks like the appropriate thing is to place the .json file in the root of the package (the folder above the top-level +folder) and then reference the function names with their full package-specific function name. As an example, check out the functionSignatures.json file in %matlabroot/toolbox/shared/io/, which contains signatures for functions like

By contrast, class methods seem to get referenced just by their method names, though class methods in @-folders are still described in the higher-level .json file. For example, in %matlabroot/toolbox/matlab/datatypes/functionSignatures.json, the method “histogram” of the categorical class is referenced simply as “histogram,” even though is a regular (non-static) method stored in the @categorical folder.

Comment on User-defined tab completions – take 2 by Yair Altman Thu, 13 Jul 2017 16:33:56 +0000 @Heiko – nice catch about the comments! Apparently functionSignatures.json is not a strictly-compliant JSON file, and undergoes some pre-processing by the Matlab engine.

Comment on User-defined tab completions – take 2 by Heiko Thu, 13 Jul 2017 14:50:35 +0000 Very nice! I’ve been waiting for a feature like this since we offered our toolbox. Especially the possibility to let MatLab determine the choices is gold. Even though it seems to depend on the type. I could not yet get it to accept other choices than a cell array. Looking forward to somebody taking the time to document a more or less complete list of options for each parameter…

About JSON comments: doing my first steps in ML R2016b I found that comments are possible. ML accidently opened the json file “R2016b\toolbox\matlab\graph2d\functionSignatures.json” which contained C-like inline comments starting with “//”. I also tried “/* */” comments successfully.

Thanks for the very useful help!!

Comment on General-use object copy by Yair Altman Sat, 08 Jul 2017 17:53:34 +0000 @Scott – nice idea!
Thanks for sharing

Comment on General-use object copy by Scott Koch Fri, 07 Jul 2017 18:15:43 +0000 Hi Bill – You might try creating a simple wrapper class to hold your old object. It’s a little hacky but seemed to work for me.

classdef wrapper

Then use the property to store your old object:

a = wrapper;
a.oldobj = oldobject;
b = getByteStreamFromArray(a);
c = getArrayFromByteStream(b);
Comment on The javacomponent function by Anu Fri, 07 Jul 2017 06:43:59 +0000 hello sir,
I have created a 2 tabgroups in my GUI.At first it is good but after adding uicontrols to those tabs using different panels i am getting errors and automatically a new hgjavacomponent is being added to GUI everytime i run the GUI. This results in abnormal behaviour of the GUI. How can i stop those hgjavacomponents visibility?

Comment on Simple GUI Tabs for Advanced Matlab Trading App by Negs Thu, 06 Jul 2017 21:32:38 +0000 Yair, Thanks for the reply. You are right, sorry I meant .m (and not .mat). No, Actually I passed the hObject and eventData correctly, but my problem was that I was using a slightly wrong syntax when setting the callback property of my object (object X). I could finally fix it by using the below syntax and now it works.


Thanks again for your time and the great tool!

Comment on Images in Matlab uicontrols & labels by Yair Altman Thu, 06 Jul 2017 12:11:18 +0000 @Klaus – not directly, but you can create a small image and add it to the button’s CData. As long as you don’t resize the button too much in either direction, this should work nicely.