Save matrix from "writematrix" to clipboard
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Tim Schaller
el 18 de Feb. de 2023
Comentada: Tim Schaller
el 19 de Feb. de 2023
Hi, I need to save a matrix to the clipboard. Because the points need to be seperated by comma, I used the function "writematrix".
a = [1 2 4;5 6 7;8 9 10];
writematrix(a,'Bachelorarbeit.txt')
type Bachelorarbeit.txt
Now i need to save the matrix shown in Matlab to the clipboard. Is there a way to do so? I could not find anything.
Thanks for helping me.
2 comentarios
Respuesta aceptada
dpb
el 18 de Feb. de 2023
You've got to create the entire text as a string or char() variable.
It would be more efficient to avoid the intermediary disk file...
a = [1 2 4;5 6 7;8 9 10];
fmt=[repmat('%g,',1,size(a,2)-1) '%g\n'];
clipboard('copy',sprintf(fmt,a.'))
content=clipboard("paste")
3 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Spreadsheets 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!