How can I add new data to specific row and colum of a matrix?

Technical Source
1 min readJul 16, 2024

--

Eg: A = [1 2 5; 3 4 6; 7 8 9];

i want to make it

A = [1 0 2 5; 3 0 4 6; 0 0 0 0; 7 0 8 9];

NOTE:-

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help , Finance Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

A = [1 2 5; 3 4 6; 7 8 9]
B = zeros(size(A) + 1)
B([1 1 0 1]>0,[1 0 1 1]>0) = A

OR

A = reshape(1:9,3,[])';
B = zeros(size(A)+1);
m = 3;
n = 2;
ii = ones(size(B));
ii(m,n) = 0;
B((+all(ii,2))*(+all(ii)) > 0) = A;

or just

SEE COMPLETE ANSWER CLICK THE LINK

https://www.matlabsolutions.com/resources/how-can-i-add-new-data-to-specific-row-and-colum-of-a-matrix-.php

--

--

Technical Source
Technical Source

Written by Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

No responses yet