How to extract multiple 'y' axis values with respect to 'x' axis from .fig file

2 ビュー (過去 30 日間)
Sun Heat
Sun Heat 2022 年 5 月 24 日
編集済み: Chunru 2022 年 5 月 25 日
hi guys,
i use this simple code to extract the 'y' axis values with respect to 'x' axis values, but it didn't work.
there are lots of individual lines in 'y' axis, that's why this code doesn't work.
Thanks in advance.

採用された回答

Chunru
Chunru 2022 年 5 月 24 日
編集済み: Chunru 2022 年 5 月 25 日
The figure is likely produced using fplot. The appropriate object handle is of type "ImplicitFunctionLine".
f=openfig('imp.fig');
f.Children.Children
ans =
ImplicitFunctionLine with properties: Function: @(theta,h)(cosd(theta).*(sind(k.*h)).^2)-(2.*(sind(k.*h.*cosd(theta)).^2)) XRange: [30 90] YRange: [0 1] Color: [0 0.4470 0.7410] LineStyle: '-' LineWidth: 0.5000 Show all properties
h=findobj(f,'type','ImplicitFunctionLine')
h =
ImplicitFunctionLine with properties: Function: @(theta,h)(cosd(theta).*(sind(k.*h)).^2)-(2.*(sind(k.*h.*cosd(theta)).^2)) XRange: [30 90] YRange: [0 1] Color: [0 0.4470 0.7410] LineStyle: '-' LineWidth: 0.5000 Show all properties
% Retrieve the data
x=get(h,'XData');
y=get(h,'YData');
% Retrieve the function (you can obtain the data by evaluating the
% function)
fcn = h.Function
fcn = function_handle with value:
@(theta,h)(cosd(theta).*(sind(k.*h)).^2)-(2.*(sind(k.*h.*cosd(theta)).^2))
xr = f.Children.Children.XRange
xr = 1×2
30 90
yr = f.Children.Children.YRange
yr = 1×2
0 1
figure
plot(x, y)
  2 件のコメント
Sun Heat
Sun Heat 2022 年 5 月 24 日
The grpah is plotted using implicit fucntion. you know how to extract values of 'y' axis.
Chunru
Chunru 2022 年 5 月 25 日
See the update above.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by