Error using vertcat Dimensions of matrices being concatenated are not consistent.
Show older comments
for y=1979:2012,
% open binary file for
% Polar Pathfinder Daily 25 km EASE-Grid Sea Ice Motion Vectors, Version 2
folderpath = 'C:\Users\SK\Documents\MATLAB\Mean_months\';
stryear = num2str(y);
filepath = fullfile(folderpath,stryear);
files = dir(fullfile(filepath,'\icemotion.mean.*.n.v02.bin') );
files = {files.name};
Umean = [];
Vmean = [];
for i=1:numel(files),
disp(files{i});
filename = fullfile(filepath,files{i});
fid = fopen(filename);
rawdata = fread(fid,[361, inf],'int16');
fclose(fid);
% reshape it into a [3x361x361] matrix
dd = reshape(rawdata,[3, 361, 361]);
% change 3d matrix to simple matrix, and divide by 10 to get cm/second
U = squeeze(dd(1,:,:)) ./ 10;
V = squeeze(dd(2,:,:)) ./ 10;
% Change the data values from cm/s to m/second by multiplying it with 1/100
U = U*1/100;
V = V*1/100;
%subset the region of interest
lat1 = 73;
lat2 = 83;
long1 = 150;
long2 = -170;
[i1,j1] = find(lat >= lat1 & lat <= lat2 & (long >= long1 | long <= long2));
U1= U(i1,j1);
V1= V(i1,j1);
Umean = [Umean, mean(mean(U1))];
Vmean = [Vmean, mean(mean(V1))];
end
Uyear = [Uyear; Umean];
Vyear = [Vyear; Vmean];
U2 = abs(Uyear);
V2 = abs(Vyear);
end
clf;
figure(1);
set(gca,'XLim',[0 13])
set(gca,'XTick',[1:1:12])
set(gca,'XTickLabel',['Jan';'Feb';'Mar';'Apr';'May';'June';'July';'Aug';'Sep';'Oct';'Nov';'Dec'])
hold all
plot(U2,'g')
xlabel('Month')
ylabel ('Ice motion(ms)')
title('Monthly Zonal-Meridional Ice Motion')
hold off
Accepted Answer
More Answers (0)
Categories
Find more on Data Preprocessing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!