How to i extract data from my plot into excel?

조회 수: 8 (최근 30일)
Akash Menon
Akash Menon 2018년 10월 19일
댓글: Akash Menon 2018년 10월 22일
Hi there community!
So I have a signal now that I've been struggling to figure out how to extract the data from the plot and save it to excel. I recently asked a question about how to plot 8640 data points across 86400 seconds. (there were 8640 measurements taken in a day and I had to plot it across the whole day). I need to now create a signal out of the plotted data to use on Simulink.
The signal that I extract from the plot must have 86400 y values and the x values must go from 0-86400 (with 1 second intervals). How do I go about doing this? I'm not an expert with matlab so if it could be dumbed down a bit that'd help. Or if there's a way to directly put it into the signal builder block in Simulink.
Thanks very much!
  댓글 수: 2
madhan ravi
madhan ravi 2018년 10월 19일
if you have the data in hand why would you extract from the plot??
Akash Menon
Akash Menon 2018년 10월 22일
I have 8640 datapoints but the range of measurement is 86400 seconds so I wanted to interpolate the values in-between.
%%Plotting the measured power signals
% Reading excel data
mydata=xlsread('pow_demand_test.xlsx');
% Adjusting the x-axis vector (86400 datapoints)
%t = days(1);
t=1:8640;
t=t*10;
% Plot 1
plot(t,mydata)
%%Interpolation of the 8640 datapoints over 86400 seconds
x1=linspace(10,86400,8640);
x2=linspace(1,86400,86400);
data2 = interp1(x1,mydata,x2);
data3=data2';
%%Plot 2
t2=1:86400;
plot(t2,data3)
Managed to do it so hope it helps others! (I used the data3 array stored in the workspace to move the data to excel then I imported that into Signal builder to build a signal out of it- the plots are only for representative purposes- the interpolated data is stored in 'data3' )

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import and Analysis에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by