The documentation page on addNewPositionCallback mentions that when the ROI object changes its position, the callback function is called with the syntax 'fcn(pos)', where pos is returned from the object's 'getPosition' method. Once you have the new position either you can assign it to a variable in the base workspace using 'assignin' or can do some calculations there and modify the sinusoid. Here is a sample script for your reference.
hFigure = figure(1);
hAx = axes;
readPic = imread('SomeImage.jpg');
imagesc(readPic);
hold on;
P1 = impoint(gca,[]);
setColor(P1,'r');
addNewPositionCallback(P1,@dragLine2);
function dragLine2(pos)
disp('position')
disp(pos)
% to assign the variable to the base workspace
assignin('base','a',pos)
% or you can modify the sin wave here using some code.
% some code here
end
I hope this helps.