Matrix dimensions do not match
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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.
0 comentarios
Respuestas (2)
Voss
el 7 de Dic. de 2023
"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).
0 comentarios
Star Strider
el 7 de Dic. de 2023
Either ‘z’ or ‘jd’ has to be a (16x1) double for that to work.
That discrepancy is throwing the dimension error.
.
0 comentarios
Ver también
Categorías
Más información sobre 2-D and 3-D 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!