RESAMPLING DATA
5 views (last 30 days)
Show older comments
Hi,
I am new here. I have Excell file with one column. In this column there are about 10 000 process data (let say temperatures). I need to export every 15th data to a new excell (every 15th row from first to the last one). Can someone help me?
Thanks in advance, Ivan
3 Comments
Daniel Shub
on 16 May 2012
Is there a reason you are not doing this directly in Excel? What have you tried so far in MATLAB?
Accepted Answer
Kye Taylor
on 16 May 2012
One way:
numData = xlsread('yourExcelFile.xlsx'); % read in data
numDataOut = numData(1:15:end); % subsample (get every 15th row)
xlswrite('yourNewExcelFile.xlsx', numDataOut); % write out data
3 Comments
Kye Taylor
on 17 May 2012
You probably realized this, but "end" inside indexing parentheses returns the largest valid index at that location.
To subsample rows, replace the second command with
numDataOut = numData(1:15:end,:);
Notice numData(1:15:end,:) referes to rows 1, 16,31,... and all the columns associated with these rows (that's the ,:). (That is, you will write out the entire first, sixteenth, thirtyfirst rows etc.)
You'll probably have more luck asking a specific question about the type of filtering you're into on the main answers page. In the meantime, you might find the following cool:
t = linspace(0,1,1024);
x = sin(2*pi*t);
noisyx = x + .1*randn(size(x));
% smooth it using local averaging
windowWidth = 20;
smoothedx = conv(noisyx, 1/windowWidth*ones(1,windowWidth),'same');
figure,plot(t,noisyx,'r',t,smoothedx,'b')
legend('original signal', 'smoothed signal');
More Answers (1)
See Also
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!