Filter löschen
Filter löschen

can anyone help me to run this code , thank you

1 Ansicht (letzte 30 Tage)
mina massoud
mina massoud am 9 Apr. 2019
Beantwortet: Walter Roberson am 10 Apr. 2019
for i=1:300
for j=1:100
A{i,j}=10*randn(2,8);
B{i,j}=10*randn(2,8);
MA{i,j}=mean(A{i,j},1);
MB{i,j}=mean(B{i,j},1);
[E{i,j}, idx{i,j}] = min([MA{i,j};MB{i,j}]);
AB{i,j} = nan(2, length(E{i,j}));
AB{i,j}(:,idx==1) = A{i,j}(:,idx==1);
AB{i,j}(:,idx==2) = B{i,j}(:,idx==2);
end
end
  1 Kommentar
Rik
Rik am 9 Apr. 2019
Have a read here (or here for more general advice). It will greatly improve your chances of getting an answer.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 10 Apr. 2019
for i=1:300
for j=1:100
A{i,j}=10*randn(2,8);
B{i,j}=10*randn(2,8);
MA{i,j}=mean(A{i,j},1);
MB{i,j}=mean(B{i,j},1);
[E{i,j}, idx{i,j}] = min([MA{i,j};MB{i,j}]);
AB{i,j} = nan(2, length(E{i,j}));
AB{i,j}(:,idx{i,j}==1) = A{i,j}(:,idx{i,j}==1);
AB{i,j}(:,idx{i,j}==2) = B{i,j}(:,idx{i,j}==2);
end
end

Weitere Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by