[datacursermode] Export curser info to workspace by button

1 回表示 (過去 30 日間)
Fritz
Fritz 2013 年 11 月 14 日
編集済み: Fritz 2014 年 5 月 6 日
Hello Everybody
Instead of right clicking to export multiple data tips with "Export curser info to workspace", is it possible to use a button to do the same thing?
Or is it possible to access the info of multiple data tips on another way.
Thank you very much Fritz

採用された回答

Fritz
Fritz 2014 年 5 月 6 日
編集済み: Fritz 2014 年 5 月 6 日
Here is my solution to my question:
function DataTips
% Example data
x = 0:pi/100:2*pi;
y = sin(x);
figure; plot(x,y);
% Datacursormode activ/inactiv
uicontrol('Units','normalized','Position',[0.3 0.01 0.2 0.05],...
'String','Datacursor Switch','Callback','datacursormode')
% Save button
uicontrol('Units','normalized','Position',[0.1 0.01 0.2 0.05],...
'String','Save Data Tips','Callback',@SaveDataTips)
function SaveDataTips(~,~)
dcm_obj = datacursormode(gcf);
Curser_Info = getCursorInfo(dcm_obj);
save('DataTips.mat', 'Curser_Info');
end
end
Greets

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by