Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Defining several maxima in the matrix

1 vue (au cours des 30 derniers jours)
Lev Mihailov
Lev Mihailov le 24 Juin 2019
Clôturé : MATLAB Answer Bot le 20 Août 2021
Hello!
I have a maximum, he is at the very beginning, how can I do this so that conditionally in the first 100 lines the maxima are not protected?
And the second question is if I have several maxima (intervals of maxima +/- 1 but one at the beginning of the column and the other at the end, how to make it so that only the second is visible?
  5 commentaires
Lev Mihailov
Lev Mihailov le 24 Juin 2019
[d,g] = max(Wscat,[],1);
for i = 1:length(d)
if g(i)+BB>size(Wscat,1);
PP=Wscat((g(i)-100:g(i)),i) ;
P{i}=PP(PP ~= 0);
elseif g(i)-100<0
PP=Wscat(1:g(i),i) ;
P{i}=PP(PP ~= 0);
else
PP=Wscat((g(i)-100:g(i)),i) ;
P{i}=PP(PP ~= 0);
end
end
Ll=cellfun('prodofsize',P);
for i = 1:length(d)
if g(i)+Ll(i)>size(Wscat,1);
nmm=Wscat(g(i):end,i) ;
mn=Wscat((g(i)-50:g(i)),i) ;
V{i}=mn(mn ~= 0);
T{i}=nmm(nmm ~= 0);
elseif g(i)-50<0
mn=Wscat(1:g(i),i) ;
nmm=Wscat(g(i):g(i)+Ll(i),i) ;
V{i}=mn(mn ~= 0);
T{i}=nmm(nmm ~= 0);
else
nmm=Wscat(g(i):g(i)+Ll(i),i) ;
mn=Wscat((g(i)-50:g(i)),i) ;
V{i}=mn(mn ~= 0);
T{i}=nmm(nmm ~= 0);
end
end
Lev Mihailov
Lev Mihailov le 24 Juin 2019
Error Subscript indices must either be real positive integers or logicals.
else
PP=Wscat((g(i)-50:g(i)),i) ;
P{i}=PP(PP ~= 0);
% so g = 1 in the 700 column

Réponses (0)

Cette question est clôturée.

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by