How to put table in another table?
6 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
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};
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Tables についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!