Filter löschen
Filter löschen

Using ismember in an if statement?

1 Ansicht (letzte 30 Tage)
Rachel Terry
Rachel Terry am 13 Apr. 2017
Bearbeitet: Rachel Terry am 13 Apr. 2017
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!

Antworten (0)

Kategorien

Mehr zu Dates and Time finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by