Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Structure to Table to Extracting Values and making new table

3 ビュー (過去 30 日間)
Kushal Kharel
Kushal Kharel 2020 年 12 月 25 日
閉鎖済み: Walter Roberson 2020 年 12 月 25 日
%mydata = hist_stock_data(now-5*365,now,'T','VZ','GOOG','NFLX','FB','EBAY','SBUX','TSLA','NKE','AMZN','KO','CL','PEP','PG','WMT','XOM','EOG','KMI','CVX','WMB','MS','JPM','WFC','BAC','GS','CVS','PFE','JNJ','UNH','ANTM','BA','CAT','HON','FDX','NOC','MSFT','CSCO','MU','ADBE','NVDA','SHW','FMC','MOS','CF','LYB','CBRE','SPG','KIM','BXP','AVB','FE','NI','PPL','AEP','CMS')
T = struct2table(mydata)
StockTicker = T.Ticker'
Date = T.Date
AdjClose = T.AdjClose
Output for StockTicker gives rows with Ticker Names
Output for Date is
55×1 cell array
{1259×1 cell}
{1259×1 cell}
{1259×1 cell}
{1259×1 cell}
{1259×1 cell}
{1259×1 cell}
{1259×1 cell}...
Output for StockTicker is all the stock names in row format
Output for AdjClose is
55×1 cell array
{1259×1 double}
{1259×1 double}
{1259×1 double}
{1259×1 double}
{1259×1 double}
{1259×1 double}
{1259×1 double}
{1259×1 double}...
What I want to do now is extract the values inside this 55x1 cell array for both Date and Adj close and assign the values to stock names in StockTicker and make a table. Output should look like
Date T VZ GOOG NFLX
12/21/2020 1 2 3 4
12/22/2020 5 6 7 8
  1 件のコメント
Walter Roberson
Walter Roberson 2020 年 12 月 25 日
https://www.mathworks.com/matlabcentral/answers/702487-extract-from-structure-and-make-a-table?s_tid=srchtitle duplicate

回答 (0 件)

この質問は閉じられています。

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by