heatmap function doesn't work (Error in heatmap (line 138))

3 次查看(过去 30 天)
I'm trying to use the heatmap function. I can't get it to work. I can't even get the example from the mathworks website to work:
cdata = [45 60 32; 43 54 76; 32 94 68; 23 95 58];
h = heatmap(cdata);
which returns:
Not enough input arguments.
(Error in heatmap (line 138)
[h3, Centers] = hist3([x1, x2], nbins) ;
I don't know how I can figure out what's wrong with my code, if the example doesn't even work. Any help would be appreciated.
  5 个评论
Star Strider
Star Strider 2019-5-7
Leave the ones that are subdirectories of: C:\Program Files\MATLAB\R2019a\toolbox\matlab\.
I would just slightly rename the one you downloaded from the File Exchange, so that it doesn’t overshadow the built-in MATLAB functions. Removimg it completely is unnecessary. It may have features you want.
Steven Lord
Steven Lord 2019-5-7
Leave them both.
The one in the @tall directory is the heatmap method used when you try to create a heatmap plot with a tall array as input.
The one in the specgraph directory is the heatmap function used when you try to create a heatmap plot with normal double precision or table data.

请先登录,再进行评论。

采纳的回答

Adam Danz
Adam Danz 2019-5-7
编辑:Adam Danz 2019-5-7
The problem was caused by a file named heatmap.m that overshadowed Matlab's built-in function of the same name. This was discovered after listing all files on path that had the name heatmap.
which heatmap -all
In r2019a (and presumably other recent releases) two files are listed that are associated with Matlab's heatmap() function.
C:\Program Files\MATLAB\R2019a\toolbox\matlab\specgraph\heatmap.m
C:\Program Files\MATLAB\R2019a\toolbox\matlab\bigdata\@tall\heatmap.m % tall method
The second one is used with tall arrays.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Distribution Plots 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by