Subtracting one column from another in the results

My macro works great and outputs all results into a text file. The problem is simply that the data I really need requires me to manually subtract one column from another after the results file is saved. Is there a way to subtract one column from another in the results?

Thank you.

Hi
@LyleB
I invite you to read this. You should find the correct code.
T [ Top ]

Table Functions

I’ve read these manuals, but it doesn’t explain how to subtract an entire results column from another before the results are saved.

Basically its a macro program that analyzed skeletal muscle cross sections and counts the number of total nuclei and the number of central nuclei within each fiber. I want to subtract the number of central nuclei from the total nuclei.

This is the section if my macro that saves the nuclei results. I’m just not sure what functions to use to subtract the ‘central nuclei’ from the ‘total myonuclei’.

roiManager(“open”, Results+“ROISet.zip”);
selectWindow(“Fiber Borders”);
run(“From ROI Manager”);
run(“Set Measurements…”, “area feret’s display redirect=None decimal=3”);
roiManager(“multi-measure append”);
updateResults();
if (isOpen(“Central Nuclei Analysis”)) {
for (i = 0; i < counts; i++) {
setResult(“Central Nuclei”, i, centronuclei_counts[i]);
}
}
if (isOpen(“Myonuclei Analysis”)) {
for (i = 0; i < counts; i++) {
setResult(“Total Myonuclei”, i, nuclei_counts[i]);
}
}
selectWindow(“Results”);
roiManager(“save”, Results+File.separator+“ROISet.zip”);
updateResults();

Sorry
I had understood to delete instead of subtract.
I use a spreadsheet.
If not
This being maybe this would suit you?

run("Blobs (25K)");
setAutoThreshold("Default");
//run("Threshold...");
//setThreshold(126, 255);
setOption("BlackBackground", true);
run("Convert to Mask");
run("Set Measurements...", "area center redirect=None decimal=3");
run("Analyze Particles...", "display exclude clear add");
n=nResults();
for(i=0;i<n;i++)
{
a=getResult("XM",i);
b=getResult("YM",i);
c=a-b;
setResult ("C",i, c);
}

It’s up to you to adapt to your problem.

1 Like

It worked perfectly. THANK YOU SO MUCH!