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 Center および File ExchangeData Types についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by