How can I add a column of data to a matrix

1 vue (au cours des 30 derniers jours)
Tyler S
Tyler S le 1 Avr 2020
Commenté : David Hill le 1 Avr 2020
I have matrix A1=[1,2,3;4,5,6;7,8,9] and b1 = [10,11,12] and I want to add it to the end of matrix A1 so that A1's size will become 3x4 instead of 3x3
  1 commentaire
Tyler S
Tyler S le 1 Avr 2020
So the result of this would make A1=[1,2,3,10;4,5,6,11;7,8,9,12]

Connectez-vous pour commenter.

Réponses (2)

David Hill
David Hill le 1 Avr 2020
  2 commentaires
Tyler S
Tyler S le 1 Avr 2020
Thats adding a row if im not mistaken I need to add b to the end of A so it adds a new column
David Hill
David Hill le 1 Avr 2020

Connectez-vous pour commenter.


darova
darova le 1 Avr 2020
Try my solution
A = [A b(:)]

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by