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

69 vues (au cours des 30 derniers jours)
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

Réponse acceptée

Les Beckham
Les Beckham le 3 Août 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

Plus de réponses (0)

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by