how to extract data from Matlab figure with stacked lines? (2024)

7 Ansichten (letzte 30 Tage)

Ältere Kommentare anzeigen

Shaymaa Tahhan am 22 Feb. 2024

  • Verknüpfen

    Direkter Link zu dieser Frage

    https://de.mathworks.com/matlabcentral/answers/2085643-how-to-extract-data-from-matlab-figure-with-stacked-lines

  • Verknüpfen

    Direkter Link zu dieser Frage

    https://de.mathworks.com/matlabcentral/answers/2085643-how-to-extract-data-from-matlab-figure-with-stacked-lines

Beantwortet: Voss am 22 Feb. 2024

  • intensity with lines.fig

In MATLAB Online öffnen

Please I have tried alot with this code

open('spectrum.fig');

a = get(gca,'Children');

xdata = get(a, 'XData');

ydata = get(a, 'YData');

xdata1 = get(a(2), 'XData');

ydata1 = get(a(2), 'YData');

but it doesnt work correctly I just get the last line data?!

0 Kommentare

-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Melden Sie sich an, um diese Frage zu beantworten.

Antworten (1)

Voss am 22 Feb. 2024

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/2085643-how-to-extract-data-from-matlab-figure-with-stacked-lines#answer_1414768

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/2085643-how-to-extract-data-from-matlab-figure-with-stacked-lines#answer_1414768

In MATLAB Online öffnen

  • intensity with lines.fig

f = openfig('intensity with lines.fig');

how to extract data from Matlab figure with stacked lines? (3)

lines = findall(f,'Type','line')

lines =

10×1 Line array: Line Line Line Line Line Line Line Line Line Line

xdata = get(lines,'XData'); % xdata: 10x1 cell array, each cell contains 1 line's XData

ydata = get(lines,'YData'); % ydata: 10x1 cell array, each cell contains 1 line's YData

If you know that the lines XData/YData are all row vectors of the same size (which they are in this case), it may be convenienet to concatentate them into a single matrix:

xdata = vertcat(xdata{:})

xdata = 10×8192

1.0e-11 * -0.6250 -0.6248 -0.6247 -0.6245 -0.6244 -0.6242 -0.6241 -0.6239 -0.6238 -0.6236 -0.6235 -0.6233 -0.6232 -0.6230 -0.6229 -0.6227 -0.6226 -0.6224 -0.6223 -0.6221 -0.6219 -0.6218 -0.6216 -0.6215 -0.6213 -0.6212 -0.6210 -0.6209 -0.6207 -0.6206 -0.6250 -0.6248 -0.6247 -0.6245 -0.6244 -0.6242 -0.6241 -0.6239 -0.6238 -0.6236 -0.6235 -0.6233 -0.6232 -0.6230 -0.6229 -0.6227 -0.6226 -0.6224 -0.6223 -0.6221 -0.6219 -0.6218 -0.6216 -0.6215 -0.6213 -0.6212 -0.6210 -0.6209 -0.6207 -0.6206 -0.6250 -0.6248 -0.6247 -0.6245 -0.6244 -0.6242 -0.6241 -0.6239 -0.6238 -0.6236 -0.6235 -0.6233 -0.6232 -0.6230 -0.6229 -0.6227 -0.6226 -0.6224 -0.6223 -0.6221 -0.6219 -0.6218 -0.6216 -0.6215 -0.6213 -0.6212 -0.6210 -0.6209 -0.6207 -0.6206 -0.6250 -0.6248 -0.6247 -0.6245 -0.6244 -0.6242 -0.6241 -0.6239 -0.6238 -0.6236 -0.6235 -0.6233 -0.6232 -0.6230 -0.6229 -0.6227 -0.6226 -0.6224 -0.6223 -0.6221 -0.6219 -0.6218 -0.6216 -0.6215 -0.6213 -0.6212 -0.6210 -0.6209 -0.6207 -0.6206 -0.6250 -0.6248 -0.6247 -0.6245 -0.6244 -0.6242 -0.6241 -0.6239 -0.6238 -0.6236 -0.6235 -0.6233 -0.6232 -0.6230 -0.6229 -0.6227 -0.6226 -0.6224 -0.6223 -0.6221 -0.6219 -0.6218 -0.6216 -0.6215 -0.6213 -0.6212 -0.6210 -0.6209 -0.6207 -0.6206 -0.6250 -0.6248 -0.6247 -0.6245 -0.6244 -0.6242 -0.6241 -0.6239 -0.6238 -0.6236 -0.6235 -0.6233 -0.6232 -0.6230 -0.6229 -0.6227 -0.6226 -0.6224 -0.6223 -0.6221 -0.6219 -0.6218 -0.6216 -0.6215 -0.6213 -0.6212 -0.6210 -0.6209 -0.6207 -0.6206 -0.6250 -0.6248 -0.6247 -0.6245 -0.6244 -0.6242 -0.6241 -0.6239 -0.6238 -0.6236 -0.6235 -0.6233 -0.6232 -0.6230 -0.6229 -0.6227 -0.6226 -0.6224 -0.6223 -0.6221 -0.6219 -0.6218 -0.6216 -0.6215 -0.6213 -0.6212 -0.6210 -0.6209 -0.6207 -0.6206 -0.6250 -0.6248 -0.6247 -0.6245 -0.6244 -0.6242 -0.6241 -0.6239 -0.6238 -0.6236 -0.6235 -0.6233 -0.6232 -0.6230 -0.6229 -0.6227 -0.6226 -0.6224 -0.6223 -0.6221 -0.6219 -0.6218 -0.6216 -0.6215 -0.6213 -0.6212 -0.6210 -0.6209 -0.6207 -0.6206 -0.6250 -0.6248 -0.6247 -0.6245 -0.6244 -0.6242 -0.6241 -0.6239 -0.6238 -0.6236 -0.6235 -0.6233 -0.6232 -0.6230 -0.6229 -0.6227 -0.6226 -0.6224 -0.6223 -0.6221 -0.6219 -0.6218 -0.6216 -0.6215 -0.6213 -0.6212 -0.6210 -0.6209 -0.6207 -0.6206 -0.6250 -0.6248 -0.6247 -0.6245 -0.6244 -0.6242 -0.6241 -0.6239 -0.6238 -0.6236 -0.6235 -0.6233 -0.6232 -0.6230 -0.6229 -0.6227 -0.6226 -0.6224 -0.6223 -0.6221 -0.6219 -0.6218 -0.6216 -0.6215 -0.6213 -0.6212 -0.6210 -0.6209 -0.6207 -0.6206

ydata = vertcat(ydata{:})

ydata = 10×8192

1.0e+00 * 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000

so that xdata(1,:) is the first line's XData, xdata(2,:) is the second line's XData, etc., etc.

0 Kommentare

-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Melden Sie sich an, um diese Frage zu beantworten.

Siehe auch

Kategorien

MATLABProgrammingProgramming Utilities

Mehr zu Programming Utilities finden Sie in Help Center und File Exchange

Tags

  • data import
  • figure data import

Community Treasure Hunt

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

Start Hunting!

Es ist ein Fehler aufgetreten

Da Änderungen an der Seite vorgenommen wurden, kann diese Aktion nicht abgeschlossen werden. Laden Sie die Seite neu, um sie im aktualisierten Zustand anzuzeigen.


Translated by how to extract data from Matlab figure with stacked lines? (4)

how to extract data from Matlab figure with stacked lines? (5)

Website auswählen

Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .

Sie können auch eine Website aus der folgenden Liste auswählen:

Amerika

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europa

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asien-Pazifik

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Kontakt zu Ihrer lokalen Niederlassung

how to extract data from Matlab figure with stacked lines? (2024)
Top Articles
Latest Posts
Article information

Author: Allyn Kozey

Last Updated:

Views: 5826

Rating: 4.2 / 5 (43 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Allyn Kozey

Birthday: 1993-12-21

Address: Suite 454 40343 Larson Union, Port Melia, TX 16164

Phone: +2456904400762

Job: Investor Administrator

Hobby: Sketching, Puzzles, Pet, Mountaineering, Skydiving, Dowsing, Sports

Introduction: My name is Allyn Kozey, I am a outstanding, colorful, adventurous, encouraging, zealous, tender, helpful person who loves writing and wants to share my knowledge and understanding with you.