Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Defining several maxima in the matrix

1 回表示 (過去 30 日間)
Lev Mihailov
Lev Mihailov 2019 年 6 月 24 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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 件のコメント
Lev Mihailov
Lev Mihailov 2019 年 6 月 24 日
[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 2019 年 6 月 24 日
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

回答 (0 件)

この質問は閉じられています。

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by