Adding 2 matrices together in matlab, got errors instead

조회 수: 1 (최근 30일)
Long Nguyen
Long Nguyen 2021년 2월 8일
댓글: Long Nguyen 2021년 2월 8일
Hello, I'm trying to add an existing matrix to another matrix, specifically i'm adding an additional column of numbers to another grid. I've tried multiple methods from matlab's suggestions but none worked and I keep getting "Dimensions of arrays being concatenated are not consistent."
For references:
a= [1 2; 3 4; 5 6]
b= [1;2;3]
My goal is to add "b" to the right side of "a" as an additional column of numbers without getting the error. If anyone can show me their input it'll be much appreciated!

채택된 답변

James Tursa
James Tursa 2021년 2월 8일
result = [a,b];

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by