Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Structure to Table to Extracting Values and making new table

3 visualizaciones (últimos 30 días)
Kushal Kharel
Kushal Kharel el 25 de Dic. de 2020
Cerrada: Walter Roberson el 25 de Dic. de 2020
%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 comentario
Walter Roberson
Walter Roberson el 25 de Dic. de 2020
https://www.mathworks.com/matlabcentral/answers/702487-extract-from-structure-and-make-a-table?s_tid=srchtitle duplicate

Respuestas (0)

La pregunta está cerrada.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by