How do I convert table with embedded cell array into simple table.

조회 수: 9 (최근 30일)
How do I convert this table
T =
1×2 table
RunDate GSWYield
______________ ______________
{723×1 double} {723×1 double}
into a 723x2 table.
Yes it seems it should be simple but for some reason all my attempts fail.
I am attempting to simply convert the figure from a graph into a simple table of values for one or all of the series.
open('Yielddata.fig')
a = get(gca,'Children');
xdata = get(a(10), 'XData');
ydata = get(a(10), 'YData');
Y_res = reshape(ydata,[],1);
X_res = reshape(xdata,[],1);
C = {X_res Y_res};
T = cell2table(C,'VariableNames',{'RunDate' 'GSWYield'})

채택된 답변

Ernest Miller
Ernest Miller 2021년 9월 22일
Simple Answer
a = get(gca,'Children');
RunDates = get(a(9), 'XData');
ylddata = get(a(9), 'YData');
gswdata = get(a(10), 'YData');
termdata = get(a(11), 'YData');
C = {RunDates' ylddata' gswdata' termdata'};
TERMYld = C{1,4};
GSWYld = C{1,3};
YLD = C{1,2};
RunDates = C{1,1};
T = table(RunDates,YLD,GSWYld,TERMYld);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by