somebody plz help me with this code. I got an error after run this code is subscript indices must either be real positive integers or logical.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MANISHA KUMARI
le 25 Nov 2019
Commenté : MANISHA KUMARI
le 26 Nov 2019
for i=1:length(left);
[R_A(i) R_t(i)]=max(sigL(left(i):raight(i)));
R_t(i)=R_t(i)-1+left(i) %add offset
[Q_A(i) Q_t(i)]=min(sigL(left(i):R_t(i)));
Q_t(i)=Q_t(i)-1+left(i)
[S_A(i) S_t(i)]=min(sigL(left(i):raight(i)));
S_t(i)=S_t(i)-1+left(i)
[P_A(i) P_t(i)]=max(sigL(left(i):Q_t(i)));
P_t(i)=P_t(i)-1+left(i)
[T_A(i) T_t(i)]=max(sigL(S_t(i):raight(i)));
T_t(i)=T_t(i)-1+left(i)+47;
end
4 commentaires
Guillaume
le 25 Nov 2019
per isakson's reply moved here as well:
You should use Comments to add to your question. From the outside it now looks as if the questions has been answered.
Cannot run your code without some values for the variable sig.
Réponse acceptée
Guillaume
le 25 Nov 2019
%your code:
left=find(difsig==1);
raight=find(difsig==-1);
So left and the mispelled raight are a vector of indices of difsig. They're positive integers that can be any value from 1 to numel(difsig),
%[...]
left=left-(6+16);
raight=raight-(6+16);
From these positive integers you then subtract 10, so they're now integers from -9 to numel(difsig)-9,
%[...]
[R_A(i) R_t(i)]=max(sigL(left(i):raight(i)));
which you're now using as indices. Clearly, there's a problem here since if left or the mispelled raight are less than 1, they can't be used to index.
Unfortunately, the comments don't really explain what you're trying to do, so it's difficult to tell you how to fix it other thanmaking sure that the indices you generate can't be less than 1.
0 commentaires
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!