Matlab - Retrieving Data From a Fig File

by MATLAB Nerdy

Okay, so you’ve saved a pcolor plot as a fig, and now you don’t want to rerun the algorithm to get your results. Another way to do this (there will be rounding errors) is to go:

a = get(gca,’Children’);

This will give you all the objects in the current axis. You will then have to find which index points to your required surface plot or image. Once this is done then use the following code (ii is the index).

c = get(a(ii), ‘CData’);
x = get(a(ii), ‘XData’);
y = get(a(ii), ‘YData’);