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

77 ビュー (過去 30 日間)
Matthew Tortorella
Matthew Tortorella 2022 年 8 月 3 日
回答済み: Les Beckham 2022 年 8 月 3 日
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

採用された回答

Les Beckham
Les Beckham 2022 年 8 月 3 日
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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by