Adding a column to a specific column of big matrix

조회 수: 4 (최근 30일)
waell telmesani
waell telmesani 2018년 2월 17일
댓글: waell telmesani 2018년 2월 20일
Hi,
I have 2 questions please: 1- if H=[1 2 5 4 1;3 4 3 4 1] % the main matrix. and H1=[8 1;9 2] how can I have the H matrix with only adding column number 1 of H1 to the column number 3 of H??
2- If I want to make the dimension of matrix H1 3*3 by adding zeros how can I do that?
Thanks

채택된 답변

Achyutha Hosahalli
Achyutha Hosahalli 2018년 2월 20일
Hi Wael !
1)
H(:,3) = H1(:,1)
This would replace all rows of column 3 of H with all rows of column 1 of H1
2)
H1(:,3) = zeros % making the third column as zeros
H1(3,:) = zeros % making the third row as zeros
These two commands will help you achieve making the dimension of matrix H1 3*3 by adding zeros
  댓글 수: 1
waell telmesani
waell telmesani 2018년 2월 20일
Thank you so much.
Regarding question 1, the column will be only replaced?? Or the values will be added(additive) together?
2- if I want to add a column of zeros in the beginning of H, how can I do that??
Thanks

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by