Basic question on correct syntax of "Merge Channels..." functino


Hi All,

I’m trying to implement the merging of two files, that are currently open, in a for loop.
When I do this manually and record what I’m doing, I see the command is:
run("Merge Channels...", "c1=file1_t1.stk c4=file2_t1.stk create");

I’ve tried to adopt this in the following way:

for (j=1;j<=s;j++){


		run("Merge Channels...", "c1=concatenated_stacks1+"+j+"+"+channel2+".tif c4=concatenated_stacks+"+j+"+"+channel2+".tif create");
		saveAs("Tiff", output + "timelapse_pos_"+j+channel1+channel2".tif");

However, I get the error message that is attached to this post. So I think the syntax is wrong when I try to specify the filename in “c1=… c2= create”. I’m not sure how to keep the names variable, which I need to as they change over the course of the loop.
Maybe that’s not even possible? Is there maybe a function with which I can get the names of the open files and pass them afterwards to the merge channels function?

Many thanks!


Probably the same problem as here…


Thanks for the reply! I solved it like that:

for (j=1;j<=s;j++){


	run("Merge Channels...", "c1=&window2 c4=&window1 create");
	saveAs("Tiff", output + "timelapse_pos_"+j+channel1+channel2);