make cell and put number on it

조회 수: 1 (최근 30일)
NA
NA 2019년 3월 11일
댓글: NA 2019년 3월 12일
n=20;
I want to make a cell from 1 to n
result should be
result={[1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20]}

채택된 답변

Rik
Rik 2019년 3월 11일
You can do it like this:
n=20;
result=num2cell(1:n);
  댓글 수: 3
Rik
Rik 2019년 3월 12일
T=cellfun(@num2str,result);
NA
NA 2019년 3월 12일
Thanks.
T=cellfun(@num2str,result,'UniformOutput', false);
without 'UniformOutput', false I have an error

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by