ERROR: Input data must be specified in column-vector format.

I get the error 'Input data must be specified in column-vector format.' when trying to run the following code at the line of TriScatteredInterp. Does someone know how to solve this?
clear
clc
load '/work/uo0122/u253082/REF.mat'
weight = cos(REF_lat);
lat=linspace(1,180,84);
lon=linspace(1,360,180);
latrep = repmat(lat,180,1);
lonrep = repmat(lon,84,1);
lonrep = lonrep';
for yr = 1993%:2010;
yr
load(['/work/uo0122/u253082/Mat_Time/ssh_',num2str(yr),'.mat']);
ssh = ssh_int;
bad=find(isnan(ssh)==1);
ssh(bad)=[];
lon(bad)=[];
lat(bad)=[];
F1=TriScatteredInterp(lon,lat,ssh,'natural');
end
thanks, Michael

回答 (1 件)

Sara
Sara 2014 年 6 月 11 日

0 投票

On the line where you have the error, check the sizes of the arrays with the command
[nrow,ncol] = size(your_array)
Then, if a vector has nrow = 1 and ncol > 1, use
your_array'

3 件のコメント

Michael
Michael 2014 年 6 月 11 日
Hi Sara, thanks for answering! I got:
[nrow,ncol] = size(ssh)
nrow =
1
ncol =
200541950
>> [nrow,ncol] = size(lon)
nrow =
1
ncol =
180
>> [nrow,ncol] = size(lat)
nrow =
1
ncol =
84
So I transposed the arrays like you said using ' but then I got the error message: Error using TriScatteredInterp. Data point coordinates have inconsistent dimension.
ssh = 1 x 200541950, lat = 1 x 84 and lon = 1 x 180
Michael
Michael 2014 年 6 月 11 日
my original ssh = 365 x 3127 x 254
Sara
Sara 2014 年 6 月 11 日
It means that the function is expecting arrays of coherent dimensions. Look into the function documentation to see what array is not coherent.
Note, this part will not work:
bad=find(isnan(ssh)==1);
ssh(bad)=[];
lon(bad)=[];
lat(bad)=[];
bad in an array of indexes in ssh, but lat and lon do not have the same dimension, so you can't do that.

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

カテゴリ

ヘルプ センター および File ExchangeGeographic Plots についてさらに検索

質問済み:

2014 年 6 月 11 日

コメント済み:

2014 年 6 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by