MATLAB: How to create six different matriceses, by changing one value in six different intry’s of an existing matrix, using a loop.

MATLABmatrix loop entry change

clc
clear all ;
close all
x=[1 2 3 4 9 10 7 8;
3 4 5 6 11 12 9 10;
7 8 9 10 15 16 13 14;
9 10 11 12 17 18 15 16]
v1=[1 2 3 4 3 4]% row koordinates for the nodes to be decoubled
v2=[3 3 3 3 5 5]% column koordinates for the nodes to be decoubled
for i=1: length(v1)
koor1{i}=v1(i)
koor2{i}=v2(i)
x{i}(koor1{i},koor2{i})=19
end
I want to create six different matrices using a loop, where the value in a specific entry is changed to 19 in each matrix. The entries are (1,3) (2,3) (3,3) (4,3) (3,5) (4,5)
An example is given below with the entry (1,3), here the value is changed from 3 to 19
x{1}=[1 2 19 4 9 10 7 8
3 4 5 6 11 12 9 10
7 8 9 10 15 16 13 14
9 10 11 12 17 18 15 16]

Best Answer

x is double class, so you don't use curly braces with that. E.g.,
x(koor1{i},koor2{i}) = 19;
Not sure what the purpose of the koor1 and koor2 is though, since you could have simply used them for the indexing. E.g.,
x(v1(i),v2(i)) = 19;
If you really want six different matrices, then use a different variable name. E.g.,
y{i} = x;
y{i}(v1(i),v2(i)) = 19;