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