How do I exact all the indexes with a certain value?
    5 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
I wrote a loop that scan through the channel that contains all the trigger markers and I set those with intensity >3 to 1, else =0. Now I have this variable (marker) that contains the trigger markers at the intensity of 1. I would like to get the indexes of marker with an intensity of 1. How should I do that? Thanks,
marker = zeros(size(Inpt_RZ2_chn002.dat));
for mi = 1:length(Inpt_RZ2_chn002.dat)-1
    if Inpt_RZ2_chn002.dat(mi) > 3
        marker(mi) = 1;
    else
        marker(mi) = 0;
    end
end
plot(marker)

0 Kommentare
Akzeptierte Antwort
  Matt J
      
      
 am 15 Mai 2023
        
      Bearbeitet: Matt J
      
      
 am 15 Mai 2023
  
      Don't use a loop. Just do,
marker = Inpt_RZ2_chn002.dat > 3;
The logical vector marker already functions as an index vector, e.g.,
greaterThanThree = Inpt_RZ2_chn002.dat(marker)
3 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Discrete Data Plots finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


