我使用NetCDF数据创建了四个变量,即height,lat,long和date。现在我想创建一个单独的矩阵,将这些变量作为一列,然后我应该忽略包含“NAN”数据的值。
我已经单独完成了这个,但我想要一个矩阵。我必须在多个文件上运行此过程。
for i = 1:length(theFiles)% Loop for each nc-file
%Select Single cycle
FileName = theFiles(i).name;
FullPathName=fullfile(folder_name, FileName); %reading file one by one
disp(['File selected:', FullPathName])
[Height,time,Lat,Long]=read_netcdf(FullPathName); % Read the selected nc file
lattiude=Lat;
longitude=Long;
B = [Height,time,Lat,Long];
end
还有一件事,总没有。数据是579X1所有变量但是当我从Height中删除Nan值时,它的尺寸减小到45X1现在我要做的是减少所有变量尺寸w.r.t高度。
我有我的矩阵,现在想要删除所有包含Nan Value的行
NaN 736536.710457717 28.3771283105297 69.6958150783291 NaN 736536.710457858 28.3778490697636 69.6956231314990 75 736536.710458284 28.3800119048871 69.6950471308031 75 736536.710458426 28.3807327583405 69.6948551510433 NaN的736536.710458000 28.3785699096006 69.6954311612445 NaN的736536.710458142 28.3792909110158 69.6952391459993
不确定这是否是你要问的,但你可以像这样增加数组的大小:
for i = 1:n
B = [B; newValue];
end