Saves the data of the plot in a text file
()
| 838 | |
| 839 | /** Saves the data of the plot in a text file */ |
| 840 | void saveAsText() { |
| 841 | if (plot.getXValues() == null) { |
| 842 | IJ.error("Plot has no data"); |
| 843 | return; |
| 844 | } |
| 845 | SaveDialog sd = new SaveDialog("Save as Text", "Values", Prefs.defaultResultsExtension()); |
| 846 | String name = sd.getFileName(); |
| 847 | if (name==null) return; |
| 848 | String directory = sd.getDirectory(); |
| 849 | IJ.wait(250); // give system time to redraw ImageJ window |
| 850 | IJ.showStatus("Saving plot values..."); |
| 851 | ResultsTable rt = plot.getResultsTable(/*writeFirstXColumn=*/saveXValues, /*useLabels=*/true); |
| 852 | try { |
| 853 | rt.saveAs(directory+name); |
| 854 | } catch (IOException e) { |
| 855 | IJ.error("" + e); |
| 856 | return; |
| 857 | } |
| 858 | if (autoClose) |
| 859 | {imp.changes=false; close();} |
| 860 | } |
| 861 | |
| 862 | /** Copy the first dataset or all values to the clipboard */ |
| 863 | @AstroImageJ(reason = "Enhanced Plot Copy", modified = true) |
no test coverage detected