How to find a special numbers among time series data

1 view (last 30 days)
SEPIDEH on 11 Aug 2015
Answered: Hikaru on 12 Aug 2015
Hi,
I have hourly data in seconds in one column and in the other worksheet I have specific time values with an amount, I want to assign the specific values from "special time-values" worksheet to the "time-second" worksheet and impose 0 value for the other time-seconds that they don't have value. I attached excel file here.
How is it possible to write a code in matlab?
Hope to hear from you. Sepideh
1 CommentShowHide None
Azzi Abdelmalek on 11 Aug 2015
This is not clear

Sign in to comment.

Answers (1)

Hikaru on 12 Aug 2015
There might be a more efficient way to do this. But, the code below should work.
timesecond = xlsread('time.xlsx'); % reads the first sheet
special = xlsread('time.xlsx','special time-values'); % reads the second sheet, 2-column variable
c = 0;
for ii = 1:length(special)
ind = find(special(ii,1)==timesecond);
c = [c;ind];
end
c(1)=[];
tvalue = zeros(length(timesecond),1);
for jj = 1:length(special)
tvalue(c(jj)) = special(jj,2);
end
0 CommentsShowHide -1 older comments

Sign in to comment.

Categories

Find more on Spreadsheets in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!