MATLAB: Extract particular element from cell and create table with titles

cellelementsMATLABnarxtabletitles

After my NARX prediction, I get 4 cells of 1×396. Since its a predictive model, only the last element (the 396th element) is relevant to me. So is there any way I can create a 4×1 table extracting only the 396th element of all 4 cells? And have titles to each of the columns in the new table.
Thanks

Best Answer

T = array2table(cellfun(@(x)x(396),C),'VariableNames',{'A','B','C','D'}) % C is your cell array