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

79 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Les Beckham
Les Beckham el 3 de Ag. de 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

Más respuestas (0)

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by