figファイルから複数のデータを抽出するにはどうすれば良いでしょう?
Show older comments
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% figファイルから複数のデータを抽出するには?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all;clc;close all;
%
%% plotデータ例の作成
t = 0:0.01:1;
x1 = 2*cos(2*pi*5*t);y1 = 3*sin(2*pi*1.5*t);
figure(1);clf(1);
plot(t,x1,t,y1);
xlabel('Time[s]');ylabel('y');
savefig('sine.fig')
%% 図からデータ抽出
hfig = open('sine.fig');
ax1 = hfig.Children
t = ax1.Children.XData; % この解釈で良いか...?
xx1 = ax1.Children.YData; % x1を取り出す
yy1 = ax1.Children.YData; % <-- y1を取り出したいがうまくいかない
%
figure(2);clf(2);plot(xx1,yy1); % x1を横軸に、y1を縦軸に描画したい
xlabel('x');ylabel('y');
Accepted Answer
More Answers (0)
Categories
Find more on グラフィックス パフォーマンス in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
