Get data out of figure file to combine with other dataset
조회 수: 6 (최근 30일)
이전 댓글 표시
Hi
I am new to Matlab
I want to get data out of .Fig file and then combine the data from .Fig file with data from spreadsheet to make a combined plot
I have large scale data 3600000 linies, but to make it simple. I have attachted a small .Fig file and a small spreadsheet.
Please help me to understand the steps I have to follow to combine the data.
댓글 수: 3
Walter Roberson
2022년 10월 14일
It isn't clear why you are not just doing
figfile = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/1156208/Fig%20import%20test%20rev1.fig';
datafile = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/1156213/Values%20to%20combine%20with%20Fig.xlsx';
tempfile = tempname() + ".fig";
fig = openfig(websave(tempfile, figfile));
T = readtable(datafile);
hold on
t = T.time;
P = T.Properties.VariableNames(2:end);
for K = 1 : length(P)
fn = P{K};
plot(t, T.(fn), 'DisplayName', fn);
end
hold off
set(gcf, 'visible', 'on')
legend show
답변 (1개)
Walter Roberson
2022년 10월 20일
이동: Walter Roberson
2022년 11월 9일
The websave layer is there in order to permit me to reference the .fig file you attached. For local use,
figfile = 'Fig import test rev1.fig';
datafile = 'Values to combine Fig.xlsx';
fig = openfig(figfile);
T = readtable(datafile);
hold on
t = T.time;
P = T.Properties.VariableNames(2:end);
for K = 1 : length(P)
fn = P{K};
plot(t, T.(fn), 'DisplayName', fn);
end
hold off
set(gcf, 'visible', 'on')
legend show
댓글 수: 5
Walter Roberson
2022년 11월 4일
이동: Walter Roberson
2022년 11월 9일
T = readtable(datafile);
T.Properties.VariableNames = ["TIME","VFD DC IN V","VFD AC OUT V"];
and you will need to change
t = T.time;
to
t = T.TIME;
참고 항목
카테고리
Help Center 및 File Exchange에서 Printing and Saving에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



