I would like to store some data in the axes handle in MATLAB. I am using the "UserData" property in order to do so. I have noticed that the "UserData" property been cleared by the plot command. Is this a normal behavior ? By plotting, I can understand that the XData and YData of the axis handle will update but why the UserData is cleared ?
Here you can find a sample code which shows my problem. I am using MATLAB 2014b.
figure
set(gca, 'UserData', 10)
disp(['UserData = ' num2str(get(gca, 'UserData'))]) % displays 10 in the command window
plot(1:10);
disp(['UserData = ' num2str(get(gca, 'UserData'))]) % displays no userdata, it is empty
hold offclears all axes properties. - sco1