make cell and put number on it

2 次查看(过去 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 个评论
NA
NA 2019-3-12
Thanks.
T=cellfun(@num2str,result,'UniformOutput', false);
without 'UniformOutput', false I have an error

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Sensors and Transducers 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by