change in Datacursor mode disappear while open the saved figure
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I have used Matlab 2014. I have changed the data cursor text using datacursormode and it's associated functions (e.g.UpdateFcn). And The data cursor text was changed successfully. but the problem is that after saving the figure, when I open the figure, it shows the default data cursor text.
Can anyone kindly help me out? How to get the changed data cursor text when open the saved figure?
snippet of code:
h_im=imagesc(flipud(transpose(wafermap)));
set(h_im,'userdata',wafermap) % find the handle for the data cursor; set the update function dcmH = datacursormode(gcf); set(dcmH,'UpdateFcn',@cursorUpdateFcn)
function output_txt = cursorUpdateFcn(obj,event_obj) % Display the position of the data cursor % obj Currently not used (empty) % event_obj Handle to event object % output_txt Data cursor text string (string or cell array of strings).
% position of the data point to label pos = get(event_obj,'Position');
data = get(get(event_obj,'Target'),'UserData');
pos(2)=43-pos(2)+1;%%%
% create the text to be displayed
output_txt = {
['X_value: ',num2str(pos(1),4)];...
['Y_value: ',num2str(pos(2),4)];...
['Data: ',num2str(data{pos(1),pos(2)},4)]};
% If there is a Z-coordinate in the position, display it as well % if length(pos) > 2 % output_txt{end+1} = ['Z: ',num2str(pos(3),4)]; % %%%end ----------- Thanks
1 comentario
michael fried
el 12 de Feb. de 2020
Editada: michael fried
el 12 de Feb. de 2020
Same here, with R2014a.
Respuestas (1)
michael fried
el 12 de Feb. de 2020
You'll have to first display the data-tip for some plot before saving the fig, then it shouldn't disappear.
Displaying a data-tip programmatically is explained by Yair Altman here: controlling-plot-data-tips
0 comentarios
Ver también
Categorías
Más información sobre Characters and Strings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!