List of future posts:
Setting preferences programmaticallySetting system-trayiconsand messagesSetting and customizing the status bar- Database connectivity using JDBC
Complex data structures: hashtables, queues, stacks, deques etc.EDT, or: why does my GUI foul up?!JFreeChart- Swing alternatives to Matlab uicontrols
Uitable – the undocumented featuresUitreeand other tree controlsUitab, uitabgroup and tabdlg- Uimode and Mode Managers
Uicontainers and Layout ManagersUiundoUiSplitPaneUicomponentUiInspectFindJObj- The JavaFrame container hierarchy
- Undocumented figure-frame properties
Undocumented toolbar functionsCustomizing menus – the undocumented stuffContext-sensitive help- Mouse cursor customizations
- Setting axes above uicontrols
- Debugging Java-Matlab connectivity
Monitoring memory usage- Undocumented Handle-Graphics properties/features
Schema: class, props and relativesSchema.listener and handle.listener- The handle() function
- Customizing the Matlab desktop
- Customizing built-in Matlab uicontrols
- Customizing docking
- Programmatically hiding and displaying the desktop, editor and relatives
- Undocumented Mex functions
Some Easter eggs…Hidden features of feature()- Grandfathered functions
- Built-in Matlab Java classes and packages
- Collapsible panels
- Using JNI to access the Matlab engine
- JGoodies Forms
Look-and-FeelsColor-selection components- Font-selection components
Calendar components- JIDE Grids
- Drag-&-Drop
Spinners and SpinnerDemoTri-state checkboxes (on,off,partial)Uisplittool and uitogglesplittoolSyntax-highlighted labels and editboxes- Hyperlinked labels
Multi-line labels- Multi-column listboxes
- Adding icons images to menus, popup menus (combo-boxes) and listboxes
- Animated busy image
- Customizing the Variable (Array) Editor
- Customizing the new ribbon (Toolstrip)
More items will be added as I remember them. Please let me know your thoughts regarding which you would like to see first, or if there are any topics you’d like to see which are not yet on this list.
Yair


Hi Yair,
Please address uitables if you have the time. Specifically, if you can address how to programatically highlight cells from within the gui, that would be *great*…for me at least
Best,
Tom
Hi Yair,
In March 2009 you posted about “Control over the Plot Window in Java” in Matlab Central. There you described a method how to capture a Matlab figure by re-parenting the Canvas to a Java frame.
Did you meanwhile get any deeper into this?
Do you have a solution how to handle resizing, callbacks of the axes and lines, etc.?
I would really appreciate any help on this!
Thx, chris
@Chris – I haven’t done much work on this since then. Perhaps I will describe this in a future post, but I feel this is a niche topic that would not interest too many people. It would have to wait quite a while before more of the wide-interest topics are covered: tables, trees, controls customization, database connectivity etc. etc.
If you need more immediate help, please contact me offline, using the email link at the top-right.
-Yair
I’m waiting with bated breath for an article related to color-selection components. In particular, I’d like to use the color-selection button that allows selection of a line’s marker color when editing line properties in the figure tools. This particular control allows selection of a color or no color.
@Ed – here is the article you requested: http://UndocumentedMatlab.com/blog/color-selection-components/
Hi,
Great site.
Anyways, I have been making some graphs and pictures in Matlab, and was just going to make some annotations. Reading the documentation, I came across pinning of annotations to the dataspace of a graph. There is no (documented) way to do this programmatically. Is there a way to do this somehow? I don’t really need this feature for my purposes since the pictures I make are just printed to still images later, its just nice to have. (And if I did want to allow moving of viewpoint, I can always just make some complicated callbacks).
Anyways, I’d be interested in any post you made that could do this.
At the risk of appearing greedy, I have another request. I see “Drag & Drop” on your list. I am implementing an ActiveX based solution for dragging files from an external file explorer to a MATLAB figure window but I’d rather use a platform-independent solution (Java?). Much obliged, in advance.
Same request for different reasons. We are revamping the SDT GUI and java based drag and drop is on the list. Any input from you (top level drop …) would be very much approciated as the rest of this very useful site.
I am also very interested in a drag & drop Java solution. I had been using one based on richtext.richtextctrl.1 that can be found on the mathworks file exchange, but it never worked on 64-bit operating systems. Now that I am using Windows 7), I am stuck.
@Eric – Drag & Drop (DND) is on my TODO list, but I do not believe that I will get around to posting an article about this before the second half of 2012, or maybe even 2013. DND is a complex issue that would be difficult to fit into a blog-type article, requiring quite a bit of effort. There are plenty of other low-lying fruits (so to speak) that I would like to publish before DND.
In the meantime, you can read section 3.7 of my Matlab-Java programming book, which is dedicated to this topic. If you want a softcopy report about using Java DND in Matlab, please email me and I will send it to you for a small fee.
If you have a specific issue that cannot wait, I would also be happy to provide you with my consulting services.
Hello!
First of all congrats for the site, it contains a lot of useful information. Maybe you can help me out in a problem I have encountered while programming a stand-alone application, which I intend to distribute. I want to replace the standard MatLab icon from the top left corner of each figure/window generated by the application. In most cases i have done it by using this line:
But this won’t work with the windows displayed by the uigetfile and menu functions.
I tried using
and
, but all I get are errors. Please help me out here.
Thanks in advance!
@Bogdan – I can’t help you with the uigetfile icon, but I can indeed help with the issue of menu icons:
I’ve prepared a 10-page report that discusses menu customizations in Matlab, including icons, fonts, colors, tooltips, text-alignment, accelerator (shortcut) keys and callback functions. If you are interested, you can get it here (please allow up to 24 hours for delivery by email).
Hi Yair,
I just came across a neat undocumented feature during a MATLAB Tour session on MATLAB Coder. The coder command opens up a small GUI that lets you generate .c/.mex/.dll/.exe files from your MATLAB functions.
The MathWorker who showed it to us explained that coder suffers from the same annoying bug horizon as does C: it only compiles up to the first bug, so you never know how much work you still have to put into the code, and if it’s worth doing so at all.
The undocumented coder.screener(‘my_function_name’) method does not compile the code, so it can look beyond the horizon, and will give you a report of the code dependencies, split into those that support code generation, and those that do not (the errors).
Cheers,
Laurens
@Laurens – thanks for the tip
Matlab code called from a COM functions IE inside of Excel, Matlab output that would normally be display in the command window if it was not called via a COM function is suppressed. I would like to see if there is a way to enable command window display during a COM function call.
Thanks
Tim
Your site is very much appreciated.
At work I often have 2-4 matlab sessions open under Linux (one for each programming task).
However, sometimes one of the sessions crashes and when I restart it, it can’t read the configuration file and opens in the default configuration with no files in the editor. That is a problem as I rely on the editor contents to remember which task I was working on.
It would be great to have a simple text backup file independent of the history and configuration files which lists which files were loaded by the editor (and maybe which matlab session loaded them). Ideally, this file would update when a new file was loaded to the editor and similarly if it was unloaded.
One suggestion was to use history. However, I often simply run files from the editor window and so the corresponding command is not in the history file and that would not tell me when the file was loaded (unloaded) beyond the date.
Any suggestions?
@Hunter – Take a look at my EditorMacro utility – it contains code that automatically detects when a new file is opened in the Editor and then does something with it (in that particular case, instruments the new document pane to listen to keyboard keystroke events). You can take that piece of code and adapt it to store the new document’s name in some external log file. Similarly, you can monitor the closing of document windows in the Editor. I’m not saying it’s trivial, but given the basic code in EditorMacro you could have it working within an hour or two.
For visualization of scientific results (as far as I know, Matlab is intended for this too) it would be quite nice to have correct bilinear value (color) interpolation when drawing quadrilateral (4 node) patches also when the figure is rotated and printed into file. It only works now using default view. Otherwise, symmetrical results do not yield symmetrical plots.
@Robert – indeed, Matlab’s built-in print function has many bugs and this is just one of them. Another bug that I constantly run into is printing GUIs that have internal Java components – they look simply awful in the printout.
My solution is usually not to use print but rather a screenshot of the figure or the requested region. I do this using my ScreenCapture utility, which uses Java’s built-in mechanism for this (see here).
Thank Yair
Can you also comment on the first part of my message – missing correct bilinear mapping in figures in general (not only printing to file)?
Do you see any scientific workaround?
@Robert – I don’t know. Try asking Customer Server (isupport@mathworks.com) – there might even be a documented way to do this.
@Yair Nope, I received information that it cannot be done now but in future version there might be completely new graphical engine. They cannot comment on this issue now and they only redirected me to these pages:
http://undocumentedmatlab.com/blog/matlab-hg2/
http://undocumentedmatlab.com/blog/new-information-on-hg2/
I wonder if there is a chance to do it now using JAVA directly in Matlab through “import javax.swing.*”? I am not experienced with JAVA yet.
@Robert
You might take a look at the SaveAsSVG.m function bundled in the Project Waterloo Swing Library.
http://sigtool.sourceforge.net/
That just uses the Apache Batik Java library (included in MATLAB distributions) to output a MATLAB figure to SVG. It seems to do what you want if I have understood correctly, but to SVG not PNG. Note that MATLAB graphics will be bitmapped, not vectorized, in the SVG
@Robert – I must say that I find Mathwork’s official response, directing you to the articles you mentioned above, both flattering and ironic.
Keep in mind that Mathworks does not endorse any of the articles or information on this website. Also, none of my information comes from official Mathworks sources (excluding what I find in the source files of course). I have made mistakes in the past, and I will probably make more mistakes in the future, and without official Mathworks feedback I will not even know that I have made some mistakes. So, everything that I report (especially about my hunches of future plans, as for HG2), should be taken with caution and skepticism.
Introduction to Matlab intended for beginners. The first part of the video can be obtained here. It comes from a course I teach as part of an online Masters degree program in engineering
Hi Yair,
what a great site – thanks!
I wondered whether you know of a solution concerning color mapping of images: When using ‘imagesc’, the data is mapped LINEARLY to the colors of the colormap. Is there a way to change the mapping function to e.g. a logarithmic one?
(I mean, as a workaround one could modify the data and then also modify the tick labels on the colorbar accordingly… but changing the mapping function would be much more elegant.)
Thanks,
Stephan.
@Stephan – you could hack imagesc and its relatives to achieve what you want, but IMHO modifying the colormap and then the colorbar would be more maintainable, not more difficult and not less elegant compared to hacking the built-in functions. You might consider wrapping up the code in a small utility – I think it could be a useful addition to the File Exchange (take a look around over there – maybe somebody has already thought of this and implemented it). If you decide to implement this utility, I suggest to have as one of its input args a parameter that accepts a function handle or function name – this way users could pass not only the @log (or ‘log’) function but also other functions (hmmm – how about @sin ???)
Hi Yair,
Thanks for all the interesting and useful functions and examples.
I have a question regarding communicating over Telnet:
I need to connect to a telnet server and send/recieve some characters (not very rapidly).
What is the best way to do it?
Thanks in advance,
Ofer
@Ofer – try the TCP/UDP Toolbox on the Matlab File Exchange. There are other alternatives, but this one appears to be very good and quite popular.
Dear Yair,
thank you very much for your great work, it proved helpul for me countless times.
I’m looking into some way to override the Ctrl+C behaviour to prevent it from crashing my (compiled) GUI when no edit box or similar has focus; did you ever look into this before?
Thanks,
Michele
@Michele – sorry, I don’t have an idea about this. I think this could be a bug – please report it to isupport@mathworks.com
Hi Yair,
do you have any clue about why the ezplot* functions, used under the symbolic toolbox, do not return a handler to the plotted object?
Cheers!
@Sergio – I do not know. Try to edit these files (they are probably simple m-files that you can edit in the Matlab editor) and find out. Don’t be afraid to modify these functions to return the handles that you need.
Hi Yair! Excellent blog!
It’d be great if you could talk about Matlab’s serial object and its tricks.
Cheers!
Charlie