Error in livescript with the clustergram function

5 views (last 30 days)
Dear all,
I am trying to compile a livescript report with my data but I am stuck on the clustergram function. Whenever I try to run the livescript section (CTRL+ENTER) I get the following error:
Error using uimenu
First argument must be a valid parent, such as a Figure or Panel object.
Error in clustergram/view>updateUIMenus (line 149)
uimenu(hw ,'Label','Print to Figure',...
Error in clustergram/view (line 61)
updateUIMenus(obj);
Error in clustergram (line 414)
obj.view;
Here is a piece of code to reproduce in Matlab 2017a and 2017b: Create a live script and press CTRL+ENTER:
cgo_J = clustergram(rand(10))
Any help or workaround would be appreciated!
Tamara

Accepted Answer

Arthur Goldsipe
Arthur Goldsipe on 25 Sep 2017
I believe clustergram needs to be updated to work properly in Live Scripts (MLX files). One workaround is to use a regular script (M file) instead. You can still create a report by publishing your script.
Alternatively, if you really want to use clustergram in a Live Script, you will need to prevent the calls to uimenu. One way to do that would be to "hide" the builtin uimenu function by replacing it with something like the following function:
function menu = uimenu(parent, varargin)
if isa(parent, 'matlab.graphics.Graphics') && (isempty(parent) || strcmp(parent.Tag, 'Clustergram'))
menu = [];
else
menu = builtin('uimenu', parent, varargin{:});
end
if nargout == 0
clear menu
end
end

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!