Export/Copy Plot Line Values
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Sami Case
il 16 Mag 2021
Commentato: Star Strider
il 16 Mag 2021
I need to be able to copy the values of a line from my plot. I know that the line is saved as a 1x70 vector in the workspace, but is there a function to copy these numbers to the clipboard. I ultimately want to use this function in the app designer, so saving directly from the workspace isn't ideal.
0 Commenti
Risposta accettata
Star Strider
il 16 Mag 2021
Try siomething like this —
x = 0:10;
y1 = x.^2;
y2 = 50*sin(2*pi*x/10)+50;
figure
hp = plot(x, y1, x, y2);
Line1X = hp(1).XData
Line1Y = hp(1).YData
Line2X = hp(2).XData
Line2Y = hp(2).YData
.
2 Commenti
Star Strider
il 16 Mag 2021
I doubt that there is a specific function for that. You would likely have to do something like this —
x = 0:10;
y1 = x.^2;
y2 = 50*sin(2*pi*x/10)+50;
figure
hp = plot(x, y1, x, y2);
Line1X = hp(1).XData.';
Line1Y = hp(1).YData.';
Line2X = hp(2).XData.';
Line2Y = hp(2).YData.';
T1 = table(Line1X, Line1Y, Line2X, Line2Y)
writetable(T1,'YourFileName.xlsx')
.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Interactive Control and Callbacks in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

