From c329f9d21a09e572f2b8b2655551a1668546fafc Mon Sep 17 00:00:00 2001 From: Jacques Grelet <jacques.grelet@ird.fr> Date: Wed, 9 Jan 2008 09:21:15 +0000 Subject: [PATCH] sous Linux, ecrite une variable empty dans une variable a la dimension unlimited crash, mise en place d'un test pour prevenir --- tsg_io/writeTSGDataNetCDF.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tsg_io/writeTSGDataNetCDF.m b/tsg_io/writeTSGDataNetCDF.m index d5e7e9a..08eb210 100644 --- a/tsg_io/writeTSGDataNetCDF.m +++ b/tsg_io/writeTSGDataNetCDF.m @@ -84,7 +84,7 @@ for i=1:numel(nca_keys) end % Create NetCDF variables and attributes -% --------------------------------------------------- +% -------------------------------------- for i=1:numel(ncv_keys) for j=1:numel(ncv_fieldNames) fn = ncv_fieldNames{j}; @@ -124,11 +124,18 @@ for i=1:numel(ncv_keys) % display waitbar waitbar( i/numel(ncv_keys), wb, ['writing ' ncv_keys{i} ' variable']); % DATE as two dimension + % don't work under windows + % nc{ncv_keys{i}}(:) = tsg.(ncv_keys{i}); if strmatch('DATE',ncv_keys(i)) nc{ncv_keys{i}}(:,:) = tsg.(ncv_keys{i}); else % other one dimension - nc{ncv_keys{i}}(:) = tsg.(ncv_keys{i}); + % under Linux, when you write an with empty matrix to an unlimited + % variable dimension, nc was corrupted to double object + % works well on windows + if ~isempty(tsg.(ncv_keys{i})) + nc{ncv_keys{i}}(:) = tsg.(ncv_keys{i}); + end end end -- GitLab