
Edit Graphs Waves In Table


hrodstein
// These procedures create a table displaying the waves used in a graph. // They add an "Edit Waves in Graph" item to the Graph menu. // They handle waveform and XY data. // You can run the procedure again on a given graph. It will add waves associated with // any new traces to the table. // The procedures do not remove waves from the table if the corresponding waves // were removed from the graph. // Example: // Make jack=sin(x/8), joe=cos(x/8) // Display jack, joe // Display jack, joe // Make xData = p, yData = p/128 // AppendToGraph yData vs xData // EditTopGraphsWaves() Menu "Graph" "Edit Waves in Graph", EditTopGraphsWaves() End Function EditGraphsWaves(graphName) String graphName // "" for top visible graph if (strlen(graphName) == 0) graphName = WinName(0, 1, 1) endif if (strlen(graphName) == 0) Abort "There are no graphs" endif String list = TraceNameList(graphName, ";", 1) Variable numItems = ItemsInList(list) if (numItems == 0) Abort "There are no traces in the graph" endif String tableName = graphName + "Table" DoWindow $tableName // Check if table already exists Variable tableAlreadyExists = V_Flag != 0 // Even if the table exists, we append the waves anyway in case traces // were added since the last time this procedure ran. Variable i for(i=0; i<numItems; i+=1) String trace = StringFromList(i, list) Wave/Z xw = XWaveRefFromTrace(graphName, trace) // There may or may not be an X wave Wave yw = TraceNameToWaveRef(graphName, trace) if (i==0 && !tableAlreadyExists) if (WaveExists(xw)) Edit /N=$tableName xw, yw else Edit /N=$tableName yw endif else if (WaveExists(xw)) AppendToTable /W=$tableName xw, yw else AppendToTable /W=$tableName yw endif endif endfor End Function EditTopGraphsWaves() EditGraphsWaves("") End

Forum

Support

Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More