HI, I am extarcting data from a THD figure in matlab.
The following is the code that i used. I am getting only 600 values of x-axis. but my figure has 15000 values at x-axis.
I request you to help me. I have attached the file.
clear all;
close all;
clc;
fig=openfig('vmpcnew1thd.fig');
dataObjsY = findobj(fig,'-property','YData');
y1 = dataObjsY(1).YData;
y2 = dataObjsY(2).YData;
dataObjsX = findobj(fig,'-property','XData');
x1 = dataObjsX(1).XData;
x2 = dataObjsX(2).XData;
Thanks and regards,
Sivakumar

 採用された回答

Ankit
Ankit 2022 年 3 月 4 日
編集済み: Ankit 2022 年 3 月 4 日

1 投票

*.fig file are basically *.mat files. You can try following in order to extract data from *.mat files
plot(rand(100,1)); % create a plot
hold on;
plot(2*rand(100,1));
hgsave(gcf,'vmpcnew1thd'); % saving a plot to a figure
data_extract = load('vmpcnew1thd.fig','-mat'); %load data to workspace
X1 = data_extract.hgS_070000.children.children(1).properties.XData; % reading xdata
X2 = data_extract.hgS_070000.children.children(2).properties.XData;
Y1 = data_extract.hgS_070000.children.children(1).properties.YData; %reading y data
Y2 = data_extract.hgS_070000.children.children(2).properties.YData;

5 件のコメント

siva kumar
siva kumar 2022 年 3 月 4 日
編集済み: siva kumar 2022 年 3 月 4 日
Hi, I need the variables in the workspace. But I cannot see the values anywhere. Could you please guide me where can get xdata and ydata. Also the figure shape is changed.
Ankit
Ankit 2022 年 3 月 4 日
can you post your *.fig? Screenshot of your figure?
siva kumar
siva kumar 2022 年 3 月 4 日
編集済み: siva kumar 2022 年 3 月 4 日
This is my figure. Both screen shot and .fig are attached. I NEED THE DATA OF THIS FIGURE. I mean frequency 1 coumn and magnitude in another coloumn.
Thanks a lot for you help.
Ankit
Ankit 2022 年 3 月 4 日
figure file is not correct. can you attach the one whos png you attached above..
siva kumar
siva kumar 2022 年 3 月 7 日
I SOVED THE ISSUE. THANKS A LOT.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

製品

質問済み:

2022 年 3 月 4 日

コメント済み:

2022 年 3 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by