I am having trouble in pushing back a vector into a matrix. Considering, N×N matrix called MyMatrix
, where N = 10
which consists of zero and non-zero elements with the diagonal elements being all zero. There are 2 vectors: Positive_Vector
of dimension 15 that consists of 10 non-zero elements extracted from MyMatrix
and ConceptsVector
consisting of N
elements respectively. Suppose the vector consists of the follwing elements
Positive_Vector = [MyMatrix(1,2), MyMatrix(1,6), MyMatrix(2,5), MyMatrix(2,6), MyMatrix(2,10), MyMatrix(3,1), MyMatrix(4,10), MyMatrix(5,3), MyMatrix(5,9),MyMatrix(6,1),MyMatrix(6,7),MyMatrix(7,3),MyMatrix(7,4),MyMatrix(8,1),MyMatrix(8,3)];
Concepts = [0.6,0.1,0.0,0.2,0.8,0.33,0.21,0.5,0.11];
My problem is how can I update MyMatrix
with a new vector New_Positive_vector
consisting of the same dimension but different values of the elements, such that the following operation
C1 = Concepts*NewMyMatrix
can be performed?
This is how I extracted the Positive_Vector
. Can somebody please show how to do the reverse ie push back the new elements of New_Positive_Vector
into the the respective places in NewMyMatrix
?
for ii = 1:10
for jj = 1:10
if (MyMatrix(ii,jj)~=0)
Positive_Vector = MyMatrix(ii,jj);
end
end
end