How to i extract data from my plot into excel?

11 views (last 30 days)
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 Comments
madhan ravi
madhan ravi on 19 Oct 2018
if you have the data in hand why would you extract from the plot??
Akash Menon
Akash Menon on 22 Oct 2018
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' )

Sign in to comment.

Answers (0)

Categories

Find more on Data Import and Analysis in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!