How to extract data from a figure as a text file

7 ビュー (過去 30 日間)
Janinia
Janinia 2025 年 9 月 28 日
編集済み: Star Strider 2025 年 9 月 28 日
Hello, I have a scatterplot that I need to save as .txt file and am confused as how to do so. My code is as follows:
data1 = readtable('600psi_15k_FT.txt');
data2 = readtable('1000psi_10k_FT.txt');
x1=data1.Var1;
y1=data1.Var2;
x2=data2.Var1;
y2=data2.Var2;
[peaks,locs]=findpeaks(y2,MinPeakHeight=0.003,MinPeakProminence=0.0006)
figure;
hold on;
plot(x1, y1, 'b-', 'DisplayName', '600psi');
plot(x2, y2, 'r-', 'DisplayName', '1000psi');
plot(x2(locs), peaks, 'ro', 'MarkerFaceColor', 'r', 'DisplayName', 'Peaks');
legend show;
hold off;
other_peaks = y1(locs);
scatter(peaks,other_peaks);
plot(peaks,other_peaks,'-o')

回答 (1 件)

Star Strider
Star Strider 2025 年 9 月 28 日
編集済み: Star Strider 2025 年 9 月 28 日
You have all the information available already in (x1,y1) and (x2,y2) and the findpeaks output.
That is apparently all the information available.
What else do you want from the plot calls?

カテゴリ

Help Center および File ExchangeDiscrete Data Plots についてさらに検索

タグ

製品


リリース

R2025b

Community Treasure Hunt

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

Start Hunting!

Translated by