Using ismember in an if statement?

1 次查看(过去 30 天)
Hi,
I have data with dates/position for 10 GPS stations. Each of the GPS stations has a date range, with some values missing and not all date ranges are the same, therefore I cannot apply equations across the arrays, such as averaging all 10 positions for each day.
So far I have created a matrix (NewDate - 10 stations) using a date set (Date) that is as wide as the largest date set from a GPS station and used ismember to create rows of 1s and 0s and multiplied them by 'Date' to place zeros in the missing dates for each GPS station.
Date=[735215:736744];
NewDate=zeros(1530, 10);
for i=1:numel(StationName)
NewDate(:,i:i)=ismember(Date, StructureName((i)).Date);
StructureName((i)).NewRow= NewDate(:,i:i).*Date;
end
What I am trying to get at.. is can I use an if statement to put position data into this structure with 0s where data is missing?
  • if date exists, then put position{1} in row 1
  • if the date is zero, place the next position in the spot where date is not a zero.
I hope that explanation wasn't too confusing... Thanks!

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Dates and Time 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by