How do I isolate a specific column within a vector

3 ビュー (過去 30 日間)
Laura T
Laura T 2021 年 12 月 8 日
コメント済み: Laura T 2021 年 12 月 8 日
Hi Guys,
How do i isolate a specific column within a vector? Like, how do i extract the 4th column only from a 5x5 matrix? What do i code to specifcally get the 4th column values to be presented as a new vector?
TIA

採用された回答

Atsushi Ueno
Atsushi Ueno 2021 年 12 月 8 日
x = rand(5,5)
x = 5×5
0.0113 0.4122 0.7657 0.0161 0.4709 0.3690 0.4130 0.6656 0.8250 0.0153 0.4433 0.3748 0.1919 0.4600 0.6638 0.7265 0.4383 0.4087 0.0044 0.5566 0.3118 0.2547 0.2757 0.9528 0.7364
y = x(:,4) % extract the 4th column only from a 5x5 matrix
y = 5×1
0.0161 0.8250 0.4600 0.0044 0.9528

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by