How to use num2cell?

1 次查看(过去 30 天)
Dixie Cross
Dixie Cross 2016-4-8
编辑: Matt J 2016-4-8
I'm trying to create a cell array. I'm using the below coding for the array but the third column contains data, which needs to be converted to a separate array to be seen. I'm not sure what I'm doing wrong.
production={'Ran k' 'Country/Region' [2014, 2013, 2012, 2011, 2010];
'2','China' [23722890,22116825,19271808,18418876,18264761];
'2','European Union',[16976883,16240989,16240476,17707126,17107350];
'3','United States',[11660699,11066432,10335765,8661535,7743093];
'4','Japan',[9774558,9630181,9943077,8398630,9628920];
'5','Germany',[5907548,5718222,5649260,6146948,5905985];
'6','South Korea',[4524932,4521429,4561766,4657094,4271741];
'7','India',[3365306,3054849,3001814,2681050,2342282];
'8','Brazil',[3364890,3712380,3402508,3407861,3381728];
'9','Spain',[2402978,2163338,1979179,2373329,2387900];
'10','Canada',[2393890,2379806,2463364,2135121,2068189]}
c=num2cell(production{:,3})

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2016-4-8
c=num2cell(cell2mat(production(:,3)))

更多回答(1 个)

Stalin Samuel
Stalin Samuel 2016-4-8
third column data is already in cell.So simply use the below
c = production(:,3)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by