Extracting data from a matlab figure and saving it as a .mat file

77 visualizzazioni (ultimi 30 giorni)
I have a figure that is a plot of drag torque versus rpm for 4 separate motor shafts. I would like to read the figure and extract the indicidual x (rpm) and y (drag torque) data for each motor shaft into an array that I can save as a .mat file. I have looked at using the 'findobj' function in MATLAB to look for the data related to each motor shafts x and y properties but I have not had any luck. I have attached the figure file I would like to extract the data for. Any help is greatly appreciated. Thanks

Risposta accettata

Les Beckham
Les Beckham il 3 Ago 2022
open('6000_1.fig')
hl = findobj(gca, 'Type', 'line'); % find the lines
x = get(hl, 'Xdata'); % extract the data
y = get(hl, 'Ydata');
figure
plot(x{1}, y{1}, x{2}, y{2}, x{3}, y{3}, x{4}, y{4}) % make a plot to ensure that we got the data

Più risposte (0)

Categorie

Scopri di più su Interactive Control and Callbacks in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by