figファイルから複数のデータを抽出するにはどうすれば良いでしょう?
古いコメントを表示
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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');
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で グラフィックス パフォーマンス についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
