I have a table 59×7 named as 'all_cities'. (Number of rows may change according to avaible data)
I exract the values according to station name. Second column is the station names(Istasyon_Adi).
names_table=all_cities{:,2}; %exract the column where station names are stored
station_names=unique(names_table); % determine the station names one by one
Then, i create unique table containing all other columns/data for each station seperately.
N_station=size(station_names,1); % Number of stations
for i=1:N_stationstation_name=station_names(i,1);% determine the station to consider for current loop
station_data=all_cities(all_cities.Istasyon_Adi==station_name,3:7); %create seperate table for considered station
end
But this loop deletes the previous table.
I need to keep all tables created within this loop seperately. Something like this;
N_station=size(station_names,1); % Number of stationsfor i=1:N_stationstation_name=station_names(i,1);% determine the station to consider for current loopstation_data(i)=all_cities(all_cities.Istasyon_Adi==station_name,3:7); %create seperate table for considered stationend
After that, i need to save the all tables created in the loop with file names which are the same as station name(station_name.xlsx)
N_station=size(station_names,1); % Number of stationsfor i=1:N_stationstation_name=station_names(i,1);% determine the station to consider for current loopstation_data(i)=all_cities(all_cities.Istasyon_Adi==station_name,3:7); %create seperate table for considered stationwritetable(station_data(i),'station_name.xlsx');% write this table to excel file, assign file names as station name considered for this loop
end
Best Answer