How to put table in another table?

8 Ansichten (letzte 30 Tage)
Behrooz Daneshian
Behrooz Daneshian am 8 Jan. 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

Antworten (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov am 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};

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by