两个维度不同的矩阵进行替换。
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
真钱视讯注册官网【359663.tv】
am 13 Okt. 2022
Beantwortet: 真钱视讯代理【gb2032 .com】
am 13 Okt. 2022
如题,矩阵A=
1 2 1 1
1 2 2 2
1 2 3 3
3 4 1 4
3 4 2 5
3 4 3 6
B=
1 2 3
3 4 5
当B的前两列和A相同时,用B的第三列替换A的第三列,即C= 1 2 3 1
1 2 3 2
1 2 3 3
3 4 5 4
3 4 5 5
3 4 5 6请问要怎么做呢
0 Kommentare
Akzeptierte Antwort
真钱视讯代理【gb2032 .com】
am 13 Okt. 2022
C=A;
[Lia,Locb]=ismember(A(:,1:2),B(:,1:2),'rows')
C(Lia,1:3)=B(Locb,:)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!