How to create a signal matrix
Afficher commentaires plus anciens
Hello, I am trying to replicate a matrix (signals2) that gives me signals of 1,0 or 1 depending on the value of each single observation in another matrix (rankfull2)-the two have the same size. I would like matrix "signals2" to show 1 when the value is above 319, -1 when is below 60 and 0 otherwise.
for iii=1:size(rankfull2,1)
for jjj= 1:size(rankfull2(1,:),2)
if rankfull2(iii,jjj) < 60
signals2(iii,jjj)= -1;
elseif rankfull2(1,jjj) > 319
signals2(iii,jjj)= 1;
else signals2(iii,jjj)= 0;
end
end
end
The output that I get seems to understand the rule of lower than 60 but not the one above 319, returning a 0 instead of a 1 (each row contains at leat 50 values above 319)
Could you someone advise if there is something wrong with my loop or if I am unaware of certain matlab rules?
Thank you in advance.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!