Getting mouse coordinates with x and y attached to them and displaying them in excel.
Mostrar comentarios más antiguos
Hello, everybody
A have an issue, I am trying to display the xy coorsdinates of the mouse clicks to an excel sheet. The things is that I am only able to write the numbers but cannot attach x or y to the assigned cell.
here's the code:
[x,y]=ginput(50200)
sheet=1;
xlRange = 'A2';
xlswrite('coordinates.xls',x,sheet,xlRange);
ylRange = 'B2';
xlswrite('cncface.xls',y,sheet,ylRange);
So, my question is, how can i get the coordinates along with 'x' or 'y' attached to them? Displaying the coordinates several times.
Thank you.
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 25 de Mzo. de 2013
towrite = {'x'; num2cell(x(:))};
xlrange = 'A1'; %note modification of range
xlswrite('coordinates.xls', towwrite, sheet, xlRange);
towrite = {'y'; num2cell(y(:))};
ylrange = 'B1'; %note modification of range
xlswrite('cncface.xls', towrite, sheet, ylRange);
Is it correct that you are wanting to write them to different files?
1 comentario
Maria Lopez
el 25 de Mzo. de 2013
Categorías
Más información sobre Cell Arrays en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!