matlab mat nc,matlab – 保存.mat文件,使用-v7.3开关?

我正在运行一个m文件,创建两个变量,Clus和Watts_Map.我想将两个变量保存到以“.mat”结尾的文件中.两个变量的尺寸为(1152,241,319),其中1152为360度经度,增量为0.3125度,241为纬度,30S-30N为0.25度增量,超过319个时间步长.代码一直工作到最后,我得到错误:

[Warning: Variable 'Clus' cannot be saved to a MAT-file whose version is older

than 7.3.

To save this variable, use the -v7.3 switch.

Skipping...]

[Warning: Variable 'Watts_Map' cannot be saved to a MAT-file whose version is

older than 7.3.

To save this variable, use the -v7.3 switch.

Skipping...]

我使用的是Matlab版本R2014a,所以会认为这是最新版本.此外,我在较小的空间域(但超过2920时间步长)上运行相同的确切代码而没有错误.

% Clear all variables, initialize counter, indexed by timestep

clc;

clear all;

rain = NaN(1152,241,319);

Clus = NaN(1152,241,319);

Areas_Final = NaN(500,319);

Wattage_Final = NaN(500,319);

Cluster_size = zeros(319,1);

Watts_Map = zeros(1152,241,319);

for year = 2000%:2008;

Nyear = sprintf('%04d',year);

% Call on the files for each year

filename = (['pr_3hr_GFDL-HIRAM-C360_amip_r1i1p1_' num2str(Nyear) '010100-' num2str(Nyear) '123123_subset_TROPICS.nc']);

disp(filename)

disp(year)

rain_rate = ncread(filename,'pr');

% Call on each timestep

for i = 960:4:2236; % Approx May 1st-Sep 30th

% Set extract subset for region, mask land areas, for each

% timestep

disp(i)

rain = rain_rate(:,:,i);

% Eliminate bad/no data points

index_rain = (rain >= (5.4e-05)) & (rain < 1e-2); % 0.2mm/hr is min rain rate

% Cluster each morning and afternoon matrix

Clus(:,:,i) = cluster_it(index_rain);

% Calculate cluster areas

Areas = cluster_areas_TROPICS(Clus(:,:,i));

Areas_Final(1:length(Areas),i) = Areas;

% Calculate cluster wattages

Wattage = cluster_wattage(Clus(:,:,i),rain);

Cluster_size(i,1) = max(max(Clus(:,:,i)));

% Create dummy matricies to populate and use to create the wattage

% maps

D = zeros(1152,241);

E = squeeze(Clus(:,:,i));

for index = 1:Cluster_size(i);

D(E == index) = Wattage(index);

end

Watts_Map(:,:,i) = D;

% Clear the dummy matricies

clear D E

end

% Save the output as a .mat file

file_out = sprintf(num2str(Nyear), year);

matfile = [file_out '_TROPICS_Watts_Maps_inc_Land_low_rain_threshold.mat'];

save(matfile, 'Clus', 'Watts_Map');

% Clear unneeded variables to save memory and prevent overwriting

clear index_rain rain Areas Wattage Clus file_out filename Areas_Final rain_rate Watts_Map Cluster_size year matfile

end

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值