フィルターのクリア

I've written a simple code in matlab. It worked a few times, but then later started showing "surf error". What could be the reason? I am not an expert in coding or matlab.

1 回表示 (過去 30 日間)
Following is a simple code I've written in matlab. This code extracts numbers from an excel sheet and makes 100 3D graphs of pressure variation with distance in the x and y direction.
x = 1:44;
y = 1:44;
for i = 1:100
a = xlsread('\\engad.foe.auckland.ac.nz\testing.xlsx','test',strcat('A',int2str(46*i-23),':','AR',int2str(46*i+20)));
figure;
surf(x,y,a);
fname = sprintf('A%d.png',i);
saveas(gcf,fname);
end
Initially, my code was working fine. But now it has started showing the following error.
Error using surf (line 57) Data dimensions must agree.
Could someone please help me out.
Thanks,
Jasnoor

採用された回答

Roger Stafford
Roger Stafford 2016 年 4 月 29 日
Well quite obviously somewhere along the line your 'a' matrix has suddenly become other than 44 x 44 in size. Your task will be to find out why.
  1 件のコメント
Jasnoor Singh
Jasnoor Singh 2016 年 4 月 29 日
Amazing man! Thanks for the prompt response! I did find the error, was directing the formula to the wrong cells. Thanks a lot!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by