Converting .nc files to an array and save it in a .txt
Show older comments
I've been working on a code to read the information of the GRACE mission the files are .nc and my Professor asked me to create an array where I save the statistics of the entire folder where all the files are, I need to save the averages of the results to a .txt file.
Can somebody guide me to some video or give me some sort of direction on what to do?
Thank you.
Answers (1)
Cris LaPierre
on 24 Jul 2023
0 votes
Here are a couple recent posts that are similar and may provide you with the help you are looking for:
- https://www.mathworks.com/matlabcentral/answers/1998568-how-to-calculate-8-days-mean-from-ten-years-data
- https://www.mathworks.com/matlabcentral/answers/1997658-how-do-i-compute-mean-values-of-nine-variables-over-lat-x-lon-x-time
You may also find this page helpful:
6 Comments
Vasco
on 24 Jul 2023
Cris LaPierre
on 24 Jul 2023
Can we assume you have written code that does everything you need for a single file?
If so, then it is just a matter of running that code for every file. There are several ways to do that. You'll find a myriad of answers here about how to load multiple files/loop through all files in a folder/etc.
Here's one example that uses dir and a for loop.
Vasco
on 24 Jul 2023
Vasco
on 24 Jul 2023
Cris LaPierre
on 24 Jul 2023
Edited: Cris LaPierre
on 24 Jul 2023
Sounds like a for loop, then. That is the solution show in the Answers post I linked to above. Can you make an attempt at taking the solution shared there and adapting it to work with your code?
Vasco
on 24 Jul 2023
Categories
Find more on Structured Data and XML Documents in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!