Borrar filtros
Borrar filtros

Use "getCursorInfo" by "codegen"

3 visualizaciones (últimos 30 días)
Ricardo Gutierrez
Ricardo Gutierrez el 22 de Dic. de 2020
Editada: Ricardo Gutierrez el 22 de Dic. de 2020
I am trying to create a DLL from a function in which I am using the "getCursorInfo" command. However, when compiling the DLL it gives the following error: Undefined function or variable 'getCursorInfo'.
Could someone help me please?
My function code is as follows:
function [pts] = getpts2d(x,y,n)
%% getpts2d Select points from a 2D plot by clicking on plot
% x - Vector of X coordinates
% y - Vector of Y coordinates
% z - Vector of Z coordinates
% n - Number of points needed to be selected
% pts - Returns a n x 3 matrix of selected points
h = figure;
plot(x,y);
pts = zeros(n,2);
datacursormode on
dcm_obj = datacursormode(h);
hold on
for i=1:n
%display(sprintf('Click on figure for point %d',i))
%waitforbuttonpress;
pause;
key=get(gcf,'CurrentKey');
if strcmp(key,'space'),
% Press space to continue peak selection
f = getCursorInfo(dcm_obj);
ptosi = f.Position;
plot(ptosi(1),ptosi(2),'o','MarkerEdgeColor','g','MarkerFaceColor','g')
pts(i,:) = f.Position; % Mark this peak as green
else
% Press any other key to ignore this peak
plot(ptosi(1),ptosi(2),'o','MarkerEdgeColor','r','MarkerFaceColor','r') % Mark this peak as red
end
end
end
obs. To create the DLL I'm using the command "codegen"

Respuestas (0)

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by