How do I isolate a specific column within a vector

3 vues (au cours des 30 derniers jours)
Laura T
Laura T le 8 Déc 2021
Commenté : Laura T le 8 Déc 2021
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

Réponse acceptée

Atsushi Ueno
Atsushi Ueno le 8 Déc 2021
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

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Tags

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by