variable dimension change nc file
Afficher commentaires plus anciens
I have downloaded era specific humidity data in .nc file.In that data specific humidity as a variable is present ant that is 4x3x4x9862 where 4=lon,3=lat,4=pressure level and 9862=time.Now I am creating a nc file where I want this in format 3x4x4x9862 where 3=lat,4=lon,4=pressure level and 9862=time. I have written a programme and create variable for nc file like that
nccreate('test_files.nc','q','Dimensions',{'lat' 3 'lon' 4 'lev' 4 'time' 9862 });
ncwrite('test2_files.nc','q',q(3,4,4,9862));
but
error Attempted to access q(3,4,4,9862); index out of bounds because
size(q)=[4,3,4,9862].
How can I solve the problem?
6 commentaires
per isakson
le 28 Août 2017
It works here on R2016a. Note that the filename is not the same in the two lines of code.
KSSV
le 29 Août 2017
Try:
nccreate('test2_files.nc','q','Dimensions',{'lat' 3 'lon' 4 'lev' 4 'time' 9862 });
ncwrite('test2_files.nc','q',q);
Tanmoyee Bhattacharya
le 29 Août 2017
KSSV
le 29 Août 2017
ncwrite('test2_files.nc','q',q(3,4,4,9862));
This is working fine in my version 2017.
Tanmoyee Bhattacharya
le 29 Août 2017
KSSV
le 30 Août 2017
In that case..write a matrix in loop.....write q(:,:,:,i) at a loop i.
Réponses (0)
Catégories
En savoir plus sur Color and Styling dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!