TEOS-10 / GSW-Matlab

Gibbs-SeaWater (GSW) Oceanographic Toolbox in Matlab - Code only !!!
24 stars 15 forks source link

Some confusion in gsw_resize.m #20

Open xiehanzhou opened 11 months ago

xiehanzhou commented 11 months ago

Hi, I think the following approach doesn't seem to meet the requirements of the function itself. https://github.com/TEOS-10/GSW-Matlab/blob/7709377a2d05b354dca9672e3e6525f1aae97762/Toolbox/library/gsw_resize.m#L53 It should be data = data(:,ones(1,sz_SA(2))); The following all have similar issues https://github.com/TEOS-10/GSW-Matlab/blob/7709377a2d05b354dca9672e3e6525f1aae97762/Toolbox/library/gsw_resize.m#L55 https://github.com/TEOS-10/GSW-Matlab/blob/7709377a2d05b354dca9672e3e6525f1aae97762/Toolbox/library/gsw_resize.m#L58 https://github.com/TEOS-10/GSW-Matlab/blob/7709377a2d05b354dca9672e3e6525f1aae97762/Toolbox/library/gsw_resize.m#L61 If I have any misunderstandings about functions, please point them out. Thanks

xiehanzhou commented 11 months ago

Using gsw_resize function yields this result

>> data = 1:10;
n = [10,10];
data1 = gsw_resize(data,n)

data1 =

     1     1     1     1     1     1     1     1     1     1

It uses data = data(:,ones(1,sz_SA(1))) I think it should be

>> data2 = data(ones(1,n(1)),:)

data2 =

     1     2     3     4     5     6     7     8     9    10
     1     2     3     4     5     6     7     8     9    10
     1     2     3     4     5     6     7     8     9    10
     1     2     3     4     5     6     7     8     9    10
     1     2     3     4     5     6     7     8     9    10
     1     2     3     4     5     6     7     8     9    10
     1     2     3     4     5     6     7     8     9    10
     1     2     3     4     5     6     7     8     9    10
     1     2     3     4     5     6     7     8     9    10
     1     2     3     4     5     6     7     8     9    10