MATLAB Answers

Undoing a Tony's Trick

72 views (last 30 days)
Jacqueline Chrabot
Jacqueline Chrabot on 4 Mar 2021
Is there a specific format for undoing a Tony's trick? I used tony's trick in a for loop earlier on in my script but now I need to correlate depth values with specific times so I need to reverse the tony trick to get the original date and times back.
  12 Comments
Jacqueline Chrabot
Jacqueline Chrabot on 5 Mar 2021
I'm trying to write a for loop that finds the max depth per hour and the time associated with it. The time is found in databin{}.Var1 and depth is databin{}.Var7. However, date is all the same since I used Tony's trick originally so I could clean the data. I want to eventually get a speed by finding the difference between each depth change and time change (distance traveled over time it took). I'm trying to find a species swimming speed in the water column by using the distance they travel up and down the water column and the time it takes them. The data in datafi, 16 tables, is the data from one cast and the species movement over a 24 hour time period.
for i=1:length(databin);
temp=databin{i};
temp=temp(:,Varnum1);
% time=databin{i};
% time=time(:,datafi.Var{1}); problem with time because its all the
% same
depth=databin{i};
depth=depth(:,Varnum2);
depthdif = diff(depth(1:end -1));
timedif(i)= diff(time(1:end-1));
ss = timedif(i)/depthdif(i); %%%theres no difference in time
end

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!