Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Structure to Table to Extracting Values and making new table

3 visualizzazioni (ultimi 30 giorni)
%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 Commento
Walter Roberson
Walter Roberson il 25 Dic 2020
https://www.mathworks.com/matlabcentral/answers/702487-extract-from-structure-and-make-a-table?s_tid=srchtitle duplicate

Risposte (0)

Questa domanda è chiusa.

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by