#pragma rtGlobals=3 // Use modern global access method and strict wave access. //the procedure is now visualized in the macros menu item Menu "Macros" "Trace manual selection" , Select_man_trace() end //function that takes a 2D matrix with different traces for different y values //selects the one that you what to keep and plot it in a movie. Function Select_man_trace() Wave trace_matrix //ask for a path where you can find a 2D matrix with the time on the x and different traces on the y. Newpath/O/Q/M="choose a 2D file containing traces" Path2DWave LoadWave/O/Q/M/P=Path2DWave rename traceContainersignal, trace_matrix Variable ii, jj, kk, aa kk = 0 aa = 0 //ask for a path where the movie will be stored Newpath/O/Q/M="choose a folder were to store the created movie" Pathtofolder Newmovie/P=Pathtofolder/F = 60 //create a new movie which will be a combination of the selected graphs Make/o/n=(dimsize(trace_matrix, 0), dimsize(trace_matrix, 1)) trace_sel //cicle to make the user select the desired traces to store in trace_sel for(ii=0; ii < 4; ii+=1) //dimsize(trace_matrix, 1); ii +=1) //create the graph that will be shown for trace selection display/N=name0 trace_matrix[][ii] ModifyGraph axThick=2 Label bottom "time, s" Label left "intensity a.u." ModifyGraph lsize=0.1 ModifyGraph/W=name0 expand=3 DoUpdate/W=name0 Variable x Prompt x, "do not enter anything" Doprompt "Press continue if you want to keep the trace",x if(V_flag == 0) for(jj=0; jj < dimsize(trace_matrix, 0); jj +=1) trace_sel[jj][kk] = trace_matrix[jj][ii] kk +=1 endfor endif //In the first option add the oppper graph and in the second the lower one to the frame. if(aa==0) //create the window that will be used as a frame in which two graphs will be displayed. display/Hide=1/W=(0,0,1050,700) display/W=(0,0,1050,350)/HOST=graph0 trace_sel[][ii] aa+=1 else display/W=(0,350,1050,700)/HOST=graph0 trace_sel[][ii] DoUpdate/W=graph0 AddMovieFrame killwindow graph0 aa = 0 endif killwindow name0 endfor //Not all the traces are loaded from trace_matrix to trace_sel then some rows will be empty //delete empty traces DeletePoints (kk+1),(dimsize(trace_matrix,1)-(kk+1)), trace_sel killwaves trace_matrix, trace_sel closemovie playmovie end