フィルターのクリア

Matrix dimensions do not match

11 ビュー (過去 30 日間)
Laura Dunn
Laura Dunn 2023 年 12 月 7 日
回答済み: Star Strider 2023 年 12 月 7 日
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.

回答 (2 件)

Voss
Voss 2023 年 12 月 7 日
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 2023 年 12 月 7 日
Either ‘z’ or ‘jd’ has to be a (16x1) double for that to work.
That discrepancy is throwing the dimension error.
.

カテゴリ

Help Center および File ExchangeGraphics Object Programming についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by