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.
Tony's trick first came to light in 1990: Loren's Blog. At that time, Matlab had a function named meshdom(), which was functionally the same as today's meshgrid() and TMW changed its implementation to use Tony's trick instead of the outer product. I'm not quite sure when Tony's trick became colloquially known as "Tony's Trick," but it can't have been too much later than that.
Sounds like it's not needed anymore. If @Jacqueline Chrabot has a variable in some state, and she needs to manipulate it to some other state, then she should give us the variable (in a .mat file), and show us what she has and what she wants to get for the output. For example, maybe it's as simple as
v2 = v(1, :)
to use Paul's example. But don't call it "Image Analyst's Trick" since it's no trick - it's just basic indexing.
I had a variable which I named datafi which had 16 cells (they are tables) of data. Each of the cells (table 1, 2, 3, 4... 16...) had a date/time vector for when chlorophyll was taken over a time period. I used Tony's Trick to make date/time on those table the same as the first date/time listed on each of those tables. I did this to run some codes for "cleaning the data" to make it easier for for loops and doing what I want to . Now that I'm trying to find the depth that is associated with certain time points, I need to convert the date back to its original form (but obviously I still want to use the "cleaned data") not the original data -which I could have pulled the original date/time from, but that data is messy.
I agree with Adam - just save it so you'll have it when you need it again.
Otherwise, attach what you have in a .mat file and tell us what you want to obtain from that variable. It will make it so much easier for people to help you if you give us the variable you're starting with and tell us what you want as the result.
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
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.