Azzera filtri
Azzera filtri

Create and update table into loop

6 visualizzazioni (ultimi 30 giorni)
Daphne PARLIARI il 29 Mar 2021
Hello guys!
I would appreciate your expertise on this:
I have a loop that reads and does several things on a series of input data. It goes like this
output_path = ('C:\PhD\Validation Natalia\Output');
obsdir = 'C:\PhD\Validation Natalia\Meteo data\Daily Data\';
wrfdir = 'C:\PhD\Validation Natalia\WRF\Daily Data\';
list1 = rdir ('C:\PhD\Validation Natalia\Meteo data\Daily Data\');
stations = readtable('C:\PhD\Validation Natalia\stations_Natalia.csv');
for i=1:size(stations,1)-1
var=('Temperature'); varunits=('C');
name = stations( i, 1 );
namestr = char(name.(1));
indx = strfind (list1, namestr) ;
for j = 1:size(indx, 1)
if (indx{j,1}>0)
if (strfind(list1{j,1}, 'txt') > 0)
obsfile = [obsdir, 'Daily_Obs_',namestr,'.txt']
Obs_Data = readtable(obsfile);
wrffile = [wrfdir, 'Daily_WRF_', namestr, '.txt']
WRF_Data = readtable(wrffile);
All=table(WRF_Data.Date_UTC, WRF_Data.Temp, Obs_Data.Temp);
All.Properties.VariableNames{1} = 'Date_UTC'; All.Properties.VariableNames{2} = 'WRF_Temp';
All.Properties.VariableNames{3} = 'Obs_Temp';
As you can see, I have data from 8 stations that are being processed. What I want to do is to store all the All tables into one separate table (e.g. Data_All_Stations), every time the i loop runs again. As a result, Data_All_Stations will have 1 Column titled Date_UTC, and 2 columns for each station (WRF_Temp and Obs_Temp with station name).
Is there a way to do so? thank you in advance!
PS. I am on Matlab 2019a.

Risposte (0)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by