how create cell 1:10 vertical

c={(1:10)'}
c = 1×1 cell array
{10×1 double}
%but is not correct..i want to creare 1x10cell

 採用された回答

Dyuman Joshi
Dyuman Joshi 2023 年 11 月 12 日

1 投票

c = (1:10).';
c = num2cell(c)
c = 10×1 cell array
{[ 1]} {[ 2]} {[ 3]} {[ 4]} {[ 5]} {[ 6]} {[ 7]} {[ 8]} {[ 9]} {[10]}

3 件のコメント

aldo
aldo 2023 年 11 月 12 日
thank but . after ) what is?
Dyuman Joshi
Dyuman Joshi 2023 年 11 月 12 日
c = (1:10)
c = 1×10
1 2 3 4 5 6 7 8 9 10
For real numbers, ctranspose, ' is equal to transpose, .'
c.'
ans = 10×1
1 2 3 4 5 6 7 8 9 10
c'
ans = 10×1
1 2 3 4 5 6 7 8 9 10
aldo
aldo 2023 年 11 月 12 日
okkk

サインインしてコメントする。

その他の回答 (1 件)

John D'Errico
John D'Errico 2023 年 11 月 12 日
編集済み: John D'Errico 2023 年 11 月 12 日

0 投票

There are always many ways to solve a problem. An easy way to create the cell array directly is to do this:
C1 = {1;2;3;4;5;6;7;8;9;10}
C1 = 10×1 cell array
{[ 1]} {[ 2]} {[ 3]} {[ 4]} {[ 5]} {[ 6]} {[ 7]} {[ 8]} {[ 9]} {[10]}
And, yes, that works nicely for a small array, but for a larger one you will want to use another tool. num2cell is a good choice, as suggested already. mat2cell will also work, but not quite as nicely.

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

質問済み:

2023 年 11 月 12 日

編集済み:

2023 年 11 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by