Created
April 18, 2017 12:56
-
-
Save Kappie/15b0b8eb88a9b465fe2bac75c4257bab to your computer and use it in GitHub Desktop.
store_data_of_current_fig_to_file.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function store_data_of_current_fig_to_file(filename) | |
% Get data vectors of current figure | |
lines = findobj(gca,'Type','line') | |
file_id = fopen(filename, 'w'); | |
for line = lines' | |
x = line.XData; | |
y = line.YData; | |
fprintf(file_id, '%3f %3f\n', [x; y]); | |
% Write two blank lines for gnuplot to recognize the next plot as separate. | |
fprintf(file_id, '\n\n'); | |
end | |
fclose(file_id); | |
type(filename) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment