Borrar filtros
Borrar filtros

How to put table in another table?

8 visualizaciones (últimos 30 días)
Behrooz Daneshian
Behrooz Daneshian el 8 de En. de 2023
Respondida: Sulaymon Eshkabilov el 8 de En. de 2023
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

Respuestas (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov el 8 de En. de 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};

Categorías

Más información sobre Tables en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by