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