2 columns put together

1 回表示 (過去 30 日間)
Samuel Shlong
Samuel Shlong 2021 年 3 月 26 日
編集済み: per isakson 2021 年 3 月 26 日
I Have
x =
0.1457
0.5850
0.0734
0.8223
0.7229
and
y =
0.9259
0.4926
0.6549
0.8901
0.5385
i would like to be able to type for example c(2) ...
and get
0.5850 0.4926
could someone please show me the code to do that

回答 (1 件)

per isakson
per isakson 2021 年 3 月 26 日
編集済み: per isakson 2021 年 3 月 26 日
One way
>> c = [x,y]; % concatenate x and y horisontally
>> c(2,:) % second row
ans =
0.585 0.4926
>>
there many other ways to concatenate arrays, e.g.
>> c = horzcat( x, y )
c =
0.1457 0.9259
0.585 0.4926
0.0734 0.6549
0.8223 0.8901
0.7229 0.5385

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by