How do I isolate a specific column within a vector

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Get 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