Killing waves being in use

ChrLie
Posts: 49
Joined: 2009-01-06
Location: Switzerland

I'm not sure if this came up before.

It would be great to have a flag and a corresponding option for the delete button in the data browser for KillWaves to delete waves which are currently being displayed in a graph or table.
It's sometimes inconvenient when you work with lots of open graphs or tables to first look through them, remove the wave and just then be able to kill it.
Or did I maybe miss a method to do all this?

Regards
Christian


RGerkin
RGerkin's picture
Posts: 123
Joined: 2008-02-22
Location: United States

In the graph browser (Misc / Graph Browser), you can enter the name of a wave, with wild cards, and find a list of graphs/tables which use that wave. Then you can kill those graphs/tables, and then kill the wave. It is also possible to write a function which looks through all graphs/tables to find which ones use your wave, removes that wave from the graphs and tables, and then kills the wave. It would look something like this, although I haven't tested it:

function ReallyKillWaves(w)
  wave w
 
  string name=nameofwave(w)
  string graphs=WinList("*",";","WIN:1") // A list of all graphs
  variable i,j
  for(i=0;i<itemsinlist(graphs);i+=1)
    string graph=stringfromlist(i,graphs)
    string traces=TraceNameList(graph,";",3)
    if(listmatch(traces,name)) // Assumes that each wave is plotted at most once on a graph.  
      RemoveFromGraph /W=$graph $name
    endif
  endfor
 
  string tables=WinList("*",";","WIN:3") // A list of all tables
  for(i=0;i<itemsinlist(tables);i+=1)
    string table=stringfromlist(i,tables)
    j=0
    do
      string column=StringByKey(table,j)
      if(strlen(column))
        RemoveFromTable /Z/W=$table $column
        j+=1
      else
        break
      endif
    while(1)
  endfor 
 
  killwaves /z w
end  

There is no way to kill the wave without killing the graph/table that uses it.


ChrLie
Posts: 49
Joined: 2009-01-06
Location: Switzerland

thanks for your reply and the code - something like that would work with a few adjustments and one would need to take into account dimension labels and x-values being displayed in a table.
Still, a flag which does it would be nice to have.
Cheers
Christian


[ last edited April 16, 2010 - 00:12 ]

Back to top