Remove Traces Inside Marquee

Create a marquee around traces of interest and remove them by right-clicking and selecting "Remove Traces Inside Marquee". Requires Igor 6.21.

Menu "GraphMarquee"
    "Remove Traces Inside Marquee", /Q, print TracesInsideMarquee("",remoov=1)
End

Function /s TracesInsideMarquee(traces[,offset,remoov,win])
    string traces,win
    string offset // Optional offset for searching traces.  Use this if something if the trace plotted does not start at wave index 0.  
    variable remoov // Remove from graph.  

    win=selectstring(!paramisdefault(win),winname(0,1),win)
    if(!strlen(traces))
        traces=tracenamelist(win,";",1)
    endif
    getmarquee /w=$win
    variable factor=ScreenResolution/72
    variable xMid=factor*(v_right+v_left)/2
    variable yMid=factor*(v_bottom+v_top)/2
    variable dx=factor*(v_right-v_left)/2
    variable dy=factor*(v_bottom-v_top)/2
    variable i,xx,yy
    string newTraces=""
    for(i=0;i<itemsinlist(traces);i+=1)
        string trace=stringfromlist(i,traces)
        string hit=""
        string options
        sprintf options,"WINDOW:%s;ONLY:%s;DELTAX:%d;DELTAY:%d",win,trace,dx,dy
        hit=tracefrompixel(xMid,yMid,options)
        if(strlen(hit))
            newTraces+=stringbykey("TRACE",hit)+";"
        endif
    endfor
    if(remoov)
        newTraces=sortlist(newTraces,";",17)
        for(i=0;i<itemsinlist(newTraces);i+=1)
            trace=stringfromlist(i,newTraces)
            removefromgraph /z/w=$win $trace
        endfor
    endif
    return newTraces
End
Not sure this'll work if the traces removed have instance numbers in them:

Display wave0,wave0,wave0


Now try removing 'wave0#1' and 'wave0#2'

I think you'll find that after removing wave0#1 that RemoveFromGraph will complain that there no longer is a 'wave0#2'.

I suggest you don't sort the list until after the removing, and do the removing in reverse order.

--Jim Prouty
Software Engineer, WaveMetrics, Inc.

Forum

Support

Gallery

Igor Pro 8

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More