How to create a signal matrix
Show older comments
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.
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!