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

2 visualizaciones (últimos 30 días)
bryan flood
bryan flood el 7 de Mayo de 2019
Editada: Adam Danz el 7 de Mayo de 2019
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 comentarios
Star Strider
Star Strider el 7 de Mayo de 2019
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 el 7 de Mayo de 2019
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.

Iniciar sesión para comentar.

Respuesta aceptada

Adam Danz
Adam Danz el 7 de Mayo de 2019
Editada: Adam Danz el 7 de Mayo de 2019
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.

Más respuestas (0)

Categorías

Más información sobre Data Distribution Plots en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by