Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Structure to Table to Extracting Values and making new table

3 Ansichten (letzte 30 Tage)
Kushal Kharel
Kushal Kharel am 25 Dez. 2020
Geschlossen: Walter Roberson am 25 Dez. 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 Kommentar
Walter Roberson
Walter Roberson am 25 Dez. 2020
https://www.mathworks.com/matlabcentral/answers/702487-extract-from-structure-and-make-a-table?s_tid=srchtitle duplicate

Antworten (0)

Diese Frage ist geschlossen.

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by