Using ismember in an if statement?

9 ビュー (過去 30 日間)
Rachel Terry
Rachel Terry 2017 年 4 月 13 日
編集済み: Rachel Terry 2017 年 4 月 13 日
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 Center および File ExchangeTime Series Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by