How to put table in another table?

8 ビュー (過去 30 日間)
Behrooz Daneshian
Behrooz Daneshian 2023 年 1 月 8 日
回答済み: Sulaymon Eshkabilov 2023 年 1 月 8 日
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

回答 (1 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023 年 1 月 8 日
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};

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by