Azzera filtri
Azzera filtri

Matrix dimensions do not match

11 visualizzazioni (ultimi 30 giorni)
Laura Dunn
Laura Dunn il 7 Dic 2023
Risposto: Star Strider il 7 Dic 2023
trying to plot three variables and I am getting an error message about the dimensions. I have z as a 19x1 double, jd as a 19x1 double and cor1 as a 19x16 double. I did a transpose and ran into the same error.
figure;
pcolor(jd,z,cor1');
datetick('x',15,'keepticks','keeplimits')
shading flat
clim([0 400]);
colorbar
title('cor1')
Error using pcolor
Matrix dimensions must agree.

Risposte (2)

Voss
Voss il 7 Dic 2023
From pcolor documentation:
"pcolor(X,Y,C) specifies the x- and y-coordinates for the vertices. The size of C must match the size of the x-y coordinate grid. For example, if X and Y define an m-by-n grid, then C must be an m-by-n matrix."
In your case, jd and z define a 19-by-19 grid (since they both are 19x1), but cor1 is not 19x19 (it's 19x16) and neither is cor1' (it's 16x19).

Star Strider
Star Strider il 7 Dic 2023
Either ‘z’ or ‘jd’ has to be a (16x1) double for that to work.
That discrepancy is throwing the dimension error.
.

Categorie

Scopri di più su Graphics Object Programming in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by