필터 지우기
필터 지우기

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