How to put table in another table?
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi all,
I have a cell("stations") for which the 3rd column is table. I want to add a table in the 8th column of that table in each row. Would you plese guide me how to to that?
Please note that station is 51*3 cell. station mfile is also attached here.
clear
close all
clc
load("stations.mat")
n = noaa("NpMoDLCgEVBMZTdPFQHQUOwllVQNHYjz");
for i=1:length(stations)
for j=1:height(stations{i,3})
annualTemperatureData = [];
for y=year(datetime(stations{i,3}{j,2})):year(datetime(stations{i,3}{j,3}))
annualTemperatureData = [annualTemperatureData;getdata(n,"GHCND", ...
datetime(strcat(num2str(y),"-01-01")), ...
datetime(strcat(num2str(y),"-12-31")), ...
stationid = stations{i,3}{j,1}, ...
datatypeid = "TAVG", ...
datatypeid = "TMIN", ...
datatypeid = "TMAX", ...
limit = 1000, ...
units = "standard")];
% stations{i,3}{j,8}=table2cell(annualTemperatureData);
stations{i,3}{j,8}=annualTemperatureData;
end
end
end
0 commentaires
Réponses (1)
Sulaymon Eshkabilov
le 8 Jan 2023
If I understood your question correctly, you are trying to add a table on the 8th column of the table variable - stations. If so, then e.g.:
A = array2table(randi(13, 10,3)); % Any Table Var to be inserted into 8th column of the existing stations
stations(:, 8)={A};
0 commentaires
Voir également
Catégories
En savoir plus sur Tables dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!