2
votes

I'm trying write a macro to save the profiles from a sequence of images. Sadly, it's not working: the images open and close correctly (and the correct profile is drawn) but the .csv is nowhere to be found.

This is the code:

function action(input, output, filename) {
    open(input+filename);
    makeLine(568, 14, 576, 1006);
    run("Plot Profile");
            saveAs("Measurements", output + filename + ".csv");
    close();
    close();
}


input = "C:\\Users\\...etc...\\20170124\\";
output = "C:\\Users\\...etc....\\20170124\\";

list = getFileList(input);
for (i = 0; i < list.length; i++)
        action(input, output, list[i]);
1
I also tried saveAs("Results", output + filename + ".csv"); - odo22
I posted a question that is similar to this one. Would you mind taking a look at it? - fi12

1 Answers

2
votes

Solved :D

function action(input, output, filename) {
    open(input+filename);
    makeLine(568, 14, 576, 1006);
    run("Clear Results");
    name = filename +".csv";
    profile = getProfile();
    for (i=0; i<profile.length; i++)
    setResult("Value", i, profile[i]);
    updateResults();
    saveAs("Results", output + name);  
}