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!