Other/simpler notation for num2cell
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Udo Kessler
am 20 Nov. 2016
Kommentiert: Star Strider
am 20 Nov. 2016
Hi,
is there another notation than - for example - num2cell(50:50:200)? I question because {50:50:200} would create a cell - so i thougth that there is -maybe- a simpler notation for getting a cell-array, without using a function..
Thanks and greetings
0 Kommentare
Akzeptierte Antwort
Star Strider
am 20 Nov. 2016
The results of the two operations are different:
C1 = num2cell(50:50:200)
C2 = {50:50:200}
C1 =
1×4 cell array
[50.0000e+000] [100.0000e+000] [150.0000e+000] [200.0000e+000]
C2 =
cell
[1×4 double]
So what you use to create the cell array depends on what you want it to be.
5 Kommentare
Star Strider
am 20 Nov. 2016
No worries!
That is the reason I directed you to the documentation for cell arrays. There are in general several ways to do most things in MATLAB, so what is ‘best’ depends upon the context.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!