Loadwave function issue

Hi

I am trying to write a program that gives you the possibility to select manually traces from
a 2D wave and display a movie of the selected one.
Each frame should be divided in an upper and lower graph in which a row from a 2D matrix is plotted.
Before the introduction of the movie option the program was working fine.
Now, the first time I run it it gives me the error "Error: while executing Display, the following error occured: expected wave name".
if I do browse wave I can see trace_matrix in the root even though I delete it at the end of the program.
The second time I run it the program works partially and then it gives me the error
"While executing Rename, the following error occurred: name already exists as a wave".

trace_selection.ipf (2.89 KB)
There are a few things that are not quite clear to me but:

- there are a number of Display commands - which one fails? Maybe you can add some sample data.
- if KillWaves is not successful (maybe the wave is still displayed somewhere?), then this explains why the Rename command fails on the second run

Note, that it might be easier to extract a row from a 2D wave using MatrixOP and the row keyword, instead of using a loop.
FWIW ... Before you re-invent too much, you might consider the ScrollTraces package. Once you have displayed all of the traces you want on a graph, call up the panel. Use it to scroll through the traces sequentially. When you are satisfied that you have exactly what you want, using a "plug-in" that you write separately, you can automatically off-load the traces to a movie.

This breaks down your larger project to smaller steps ...

(write a "save to movie" plug-in)

* load the data file
* select (and create a copy of) the waves you want for the movie
* display that selection of waves on a graph
* call up the Scroll Traces panel
* run the panel in automatic mode to create the movie

http://www.igorexchange.com/project/ScrollTracesPanel

I would be glad to help you complete the plug-in. Let me know.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
HI

Thank you for the possible solutions, I will try them today. I have attached a file containing traces
as an example so that you can understand better which are the bugs.
Also, concerning the rename error. I agree with you that is related to a problem with the killwave option
but I do not understand why the first time I run the procedure it does not even display the first graph:

//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
It seems like the matrix is not loaded in the time scale of the experiment.

Thanks again :)
030_0_SignalTr.ibw (1.64 MB)
It is a bit confusing: your function requires the wave trace_matrix to be present in the current data folder. But then you load a wave and want to rename it to trace_matrix. This is not a good start. I suggest to use the debugger, e.g. execute:

DisplayHelpTopic "The debugger",

to see what's happening in each line of code.

Quote:
Do you know a way to directly give a name to the loaded wave without using
duplicate or rename?

Use the LoadWave /B flag.
jjweimer wrote:


This breaks down your larger project to smaller steps ...

(write a "save to movie" plug-in)

* load the data file
* select (and create a copy of) the waves you want for the movie
* display that selection of waves on a graph
* call up the Scroll Traces panel
* run the panel in automatic mode to create the movie

http://www.igorexchange.com/project/ScrollTracesPanel

I would be glad to help you complete the plug-in. Let me know.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville



Hi,

I wrote the plug in versions as suggested. Now, if I run them one by one they
work as expected but If I call the functions in sequence using MAIN_trace_selection_AB
it gives me an error, I already used the debugger and it tells me that the problem is
in the function Select_traces_algorithm1() of the file trace_selection.
I guess I need some help to complete the plug-in.


Beginner_Igor wrote:
...
I guess I need some help to complete the plug-in.


Would you package your files and a representative data file in a ZIP archive and email that to me directly. Just use the Contact part of the IgorExchange link that shows when you view my profile information.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville