subplotにより複数のグラフが存在するfigureファイルからのXData,YDataの取り出し方
26 views (last 30 days)
Show older comments
figureファイルに格納されているXDataとYDataを取り出したです.
こちらのURLを参考に,XDataを取り出そうとしたところ,
subplotを利用して6つのグラフを1つのfigurファイルにまとめて保存しているためか,
以下のエラー文が出ました.
'中かっこまたはドット インデックス式からの必要な出力は1つですが、6個の結果があります.'
subplotで複数のグラフがあるfigureデータから所望のXData,YDataを取り出すにはどうすれば良いですか?
0 Comments
Accepted Answer
Kenta
on 31 Jan 2020
こんにちは、以下のようにすれば可能です。
たとえば、最後のグラフに対して、生データの値とグラフから読みだしたデータが一致していることをご確認お願い致します。
詳しくはコードの方を参照いただけると幸いです。
clear;clc;close all
for i=1:6
t = 0:0.01:1;
param = randi(100,[2 1])-50;
y = sin(param(1)*pi*param(2)*t);
f(i)=subplot(2,3,i);
plot(t,y)
end
t(50:60)
ax1 = f(6).Children;
x1 = ax1.XData;
y1 = ax1.YData;
x1(50:60)
y(50:60)
y1(50:60)
2 Comments
More Answers (0)
See Also
Categories
Find more on Subplots 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!