![result].JPG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/269212/result].jpeg)
subplotにより複数のグラフが存在するfigureファイルからのXData,YDataの取り出し方
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
figureファイルに格納されているXDataとYDataを取り出したです.
こちらのURLを参考に,XDataを取り出そうとしたところ,
subplotを利用して6つのグラフを1つのfigurファイルにまとめて保存しているためか,
以下のエラー文が出ました.
'中かっこまたはドット インデックス式からの必要な出力は1つですが、6個の結果があります.'
subplotで複数のグラフがあるfigureデータから所望のXData,YDataを取り出すにはどうすれば良いですか?
0 Kommentare
Akzeptierte Antwort
Kenta
am 31 Jan. 2020
こんにちは、以下のようにすれば可能です。
たとえば、最後のグラフに対して、生データの値とグラフから読みだしたデータが一致していることをご確認お願い致します。
詳しくはコードの方を参照いただけると幸いです。
![result].JPG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/269212/result].jpeg)
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Subplots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!