How do I isolate a specific column within a vector

조회 수: 2 (최근 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 CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by