Comments for Undocumented Matlab Charting Matlab's unsupported hidden underbelly Fri, 18 Aug 2017 20:57:49 +0000 hourly 1 Comment on Bar plot customizations by dgm Fri, 18 Aug 2017 20:57:49 +0000 Thanks for this solution. In addition to needing to label the individual bars, I have floating point numbers as the labels at the tops of the bars. Is there a way to center those labels over the bars instead of starting the text at the mid-point of each bar?

Comment on General-use object copy by Mario Koddenbrock Wed, 16 Aug 2017 10:44:38 +0000 Thanks for your fast reply @Yair.

I’m really just trying to copy an object inside my workspace. There is no file IO involved…

Comment on General-use object copy by Yair Altman Wed, 16 Aug 2017 09:45:51 +0000 @Mario – I suspect that you are trying to move data between different computer types and/or different Matlab releases, and this is apparently not supported.

Comment on General-use object copy by Mario Koddenbrock Wed, 16 Aug 2017 09:41:12 +0000 Hi Yair,

from time to time I get the following error:

"Error using getArrayFromByteStream
Unable to read data stream because the data contains a bad version or endian-key"

It seems not to be reproducable.
Do you know reasons or fixes for that?

Best regards,

Comment on Sending email/text messages from Matlab by Yair Altman Sun, 13 Aug 2017 10:08:22 +0000 @Muhammad – you can use this feature to send text messages as long as your phone operator supports an email-to-text feature. You need to contact your operator to find out the specific details.

As far as I know WhatsApp does not enable outside programs to communicate with it, and has no plans to do so in the near future.

Comment on Sending email/text messages from Matlab by Muhammad Abdurrehman Sun, 13 Aug 2017 09:58:13 +0000 Could this function (Sending Text Messages) useful outside USA?

Secondly Is there any possibility available to communicate with WhatsApp via Matlab


Comment on Editable combo-box by Yair Altman Sat, 12 Aug 2017 17:44:39 +0000 @Eric – you can integrate a com.jidesoft.combobox.MultiSelectListComboBox or MultilineStringComboBox. If you need consulting assistance, contact me by email.

Comment on Aligning uicontrol contents by Yair Altman Sat, 12 Aug 2017 17:37:57 +0000 @Les – HTML formatting is more CPU and memory-intensive, while being less powerful, than using Cell Renderers (details). Also, whenever you update an HTML-formatted cell, you’d see the full HTML string as the text in the cell content, which is a bit awkward. Also, if you try to get the values in the table, you’d need to parse out the HTML tags.

However, there is no dispute that HTML formatting is super-easy to use, and in many cases the drawbacks listed above pale in comparison to the simplicity and usefulness of HTML formatting. So in general I use HTML formatting for most simple formatting, and I only use Cell Renderers for large tables (with numerous formatted cells), when the formatting is not easy to achieve with HTML, and/or when the table cells need to be updated by the user.

Comment on Aligning uicontrol contents by Les Beckham Sat, 12 Aug 2017 03:01:06 +0000 Interesting post, as always.

I’m curious why you state that “HTML formatting is generally frowned-upon compared to the alternatives”. By whom? And why?

Perhaps you can elaborate.

Thank you

Comment on Editable combo-box by Eric Fri, 11 Aug 2017 17:31:49 +0000 I created a plotter using three popup menus: one for X-variable, one for Y, and one for a figure name. When a figure name (number) is selected, its callback function grabs strings from X and Y popup menus, search these from a loaded dataset, and plots them.

What I want to do is multiple-selection on a popup menu. I researched quite a bit and learned that popup menu doesn’t have that capability as you also mentioned on the top in the regular documented way.

The reason why I don’t want and almost can’t use list box is my GUI has many panels from top to bottom; each containing the three popup menus mentioned above. Each panel represents one dataset. This means if I select and load ten .MAT files, a GUI will be created with 10 panels from top to bottom. Each dataset can have as many as 100 or more variables. Unless I completely scrub the current GUI generation code, listbox won’t work. Say each listbox shows ten variables and a scroll bar. The height of it and some margins above and below times 10 will create a gigantic GUI that will be basically unusable.

Do you know a work-around? Thank you in advance.

Comment on A few parfor tips by William Smith Tue, 08 Aug 2017 07:18:44 +0000 If you have heterogenous workloads, i.e. some of the parfor tasks are quick and some are slow, and they are clustered together, e.g. the slow ones are at the start, try putting your work into an array, then randomizing the array:

irand = randperm(numel(work));
work = work(irand);

If you have *very* heterogeneous workloads, such that some of the parfor elements will take a long time, and some will be ‘0 work’, it may be more efficient to compute which elements have ‘0 work’ beforehand and remove these elements from the work. Otherwise the very heterogeneous workloads won’t balance well across the cores, and you may well be left with a few cores running long running tasks, while the others have completed.

Comment on GUI automation using a Robot by Mayank Sat, 05 Aug 2017 13:01:00 +0000 create an int[] array for all the KeyEvent.Vk_1 to ..last then use the for loop to iterate over the same.

Comment on Afterthoughts on implicit expansion by Sue Ann Koay Fri, 04 Aug 2017 01:37:22 +0000 Having only recently installed Matlab 2017a, I almost immediately “discovered” this feature and am compelled to say that implicit expansion gives me the creeps. As an outside example: why do some languages like C++ impose type safety? It’s not because programmers can’t write their own type checking code. For a 10-line function I can easily write 50 lines of code to perform every possible check I can think of to ensure that the inputs are of the correct type and sizes and ranges and whatnot. Will this make me a better coder? Maybe. Will chances be high that I’ll do it for every function? If I existed solely for such a purpose, maybe. Will this help others read and modify my code down the line? Well…

As a person from a joint CS/science background, I’m certainly not advocating sloppy coding practices. I think implicit expansion (and yes also lack of type safety) actually goes towards encouraging sloppy coding practices. Now instead of a self-documenting piece of code where one uses bsxfun(), if I read the line a .* b somewhere I have to wonder if it is the outer product of vectors or an element-wise product or anything goes. The best designed systems limit the amount of mistakes that humans can make, and allowing the syntax itself to be sloppy doesn’t seem very encouraging.

Comment on User-defined tab completions – take 2 by Sky Sartorius Thu, 27 Jul 2017 01:43:52 +0000 I have been encountering some interesting behavior in 2017b. Signatures that were working in 2017a now do not, though the error message does look like it is trying to be helpful: “Unable to load signatures for 'foo'. 'namevalue' and 'flag' arguments may not appear both inside and outside of groups.” So, it appears that this is a new “rule” for signatures (and violating the rule was giving me the desired behavior before).

TMW seems to get around this (see signatures for e.g. join) by putting a copy of each ‘outside’ arguments in every member of an existing MEG. Another workaround that seems to work is to put each ‘outside’ argument in its own (lonely) MEG, which has the benefit of avoiding duplicates.

Comment on Customizing menu items part 3 by Sneha Wed, 26 Jul 2017 11:23:51 +0000 Hi Yair,
Apologies for my late reply. I did not attach the code previously sorry for that
The below is the code written
jf = get(hObject,’JavaFrame’);
jmb = jf.fHG2Client.getMenuBar;
jFileMenu = jmb.getComponent(0);
jFileMenu.doClick; %% open menu
jFileMenu.doClick; % close the menu
jvalue1 = jFileMenu.getMenuComponent(0);
jvalue3 = jFileMenu.getMenuComponent(2);

So this code if I execute line by line I am able to get tool tip messages but i run code as a .m file I gt that error

Comment on Customizing Workspace context-menu by Lex Wed, 26 Jul 2017 07:16:41 +0000 Thank you, Yair! I use Matlab 2017a and make menu for Java class ‘java.lang.Object’. But this menu item appears only for this class and don’t take inheritance into account. Can I make menu item for all Java variables?

Comment on Plot line transparency and color gradient by Yair Altman Tue, 25 Jul 2017 01:20:41 +0000 I don’t think the lines will look disjointed if you ensure that the endpoints are exactly the same.

Comment on Plot line transparency and color gradient by Vlad Atanasiu Mon, 24 Jul 2017 21:12:37 +0000 Correct, Yair. But you will have problems where lines meet: their extremities will look disjoined.

Comment on Plot line transparency and color gradient by Yair Altman Sun, 23 Jul 2017 05:20:42 +0000 @Vlad – I am not aware of an outline property, but you should be able to replicate it by using two overlapping lines that have different colors/transparency levels, one line slightly wider than the other.

Comment on Plot line transparency and color gradient by Vlad Atanasiu Sun, 23 Jul 2017 04:32:21 +0000 Hello Yair,

Do you known if there is an “outline.Color” property for the “line” object? It would make 3D objects much more readable in terms of what is front and what is back (get rid of the Necker illusion). See, e.g.,