![result].JPG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/269212/result].jpeg)
subplotにより複数のグラフが存在するfigureファイルからのXData,YDataの取り出し方
조회 수: 10 (최근 30일)
이전 댓글 표시
figureファイルに格納されているXDataとYDataを取り出したです.
こちらのURLを参考に,XDataを取り出そうとしたところ,
subplotを利用して6つのグラフを1つのfigurファイルにまとめて保存しているためか,
以下のエラー文が出ました.
'中かっこまたはドット インデックス式からの必要な出力は1つですが、6個の結果があります.'
subplotで複数のグラフがあるfigureデータから所望のXData,YDataを取り出すにはどうすれば良いですか?
댓글 수: 0
채택된 답변
Kenta
2020년 1월 31일
こんにちは、以下のようにすれば可能です。
たとえば、最後のグラフに対して、生データの値とグラフから読みだしたデータが一致していることをご確認お願い致します。
詳しくはコードの方を参照いただけると幸いです。
![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)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Subplots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!