make cell and put number on it

1 visualizzazione (ultimi 30 giorni)
NA
NA il 11 Mar 2019
Commentato: NA il 12 Mar 2019
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]}

Risposta accettata

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

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Dates and Time in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by