How can I delete the extra matrices which contain NaN and 0 values?
1 次查看(过去 30 天)
显示 更早的评论
Dear All, I have a 30 year dataset (1961.02.1-1990.11.30) in cell array which contains 358 matrices where the data are stored longitude x latitude x days. I had to convert this cell to 4D matrix for calculation. I carried out this by the following way:
maxSize = max(cellfun(@(x) size(x,3),out_m));
f = @(x) cat(3, x, nan(size(x,1),size(x,2),maxSize-size(x,3)));
out_m2 = cellfun(f,out_m,'UniformOutput',false);
PL = bsxfun(@times, out_m2, l);
PL2=reshape(num2cell(PL,[1 2 3]),[],1);
P_scen=cat(3,PL2{:});
Thust every month has 31 days. I would like to write the P_scen into netcdf file. The values are stored longitude x latitude x time. Its time length is 11098 due to the conversation. The time has to be determined in netcdf file by:
T(:,1)=[datenum(1961,2,1,0,0,0):datenum(1990,11,30)];
time(:,1)=T(:,1)-datenum(1950,1,1);
So this time length is 10895. How can I delete the extra days which contain NaN and 0 values? Thank you for your help in advance!
2 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 NetCDF 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!