Colordata Error in Heatmap

7 vues (au cours des 30 derniers jours)
Komal Shah
Komal Shah le 14 Oct 2020
Commenté : Komal Shah le 15 Oct 2020
I am using heatmap like this:
FigureGenerated = heatmap(x_axis_val,y_axis_val,capture_status,'Colormap',mymap);
saveas(FigureGenerated,Path_Capture_Status);
where x_axis_val (1st column) and y_axis_val (2nd column) are created as per user input. And capture_status contains all values of the 5th column of the same matrix.
The code works fine sometimes, but at other times I get the following error:
Error using heatmap (line 53)
Number of x values must equal the number of columns in
'ColorData'.
How can this be solved?
Please help. Thanks a lot.

Réponses (1)

Ameer Hamza
Ameer Hamza le 14 Oct 2020
It means that if the dimensions are
n = numel(x_axis_val)
m = numel(y_axis_val)
Then the dimensions of capture_status should be m*n.
  5 commentaires
Ameer Hamza
Ameer Hamza le 15 Oct 2020
You can use the breakpoints: https://www.mathworks.com/help/matlab/matlab_prog/set-breakpoints.html to find the error.
Komal Shah
Komal Shah le 15 Oct 2020
Thank you, I will try this.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by