Re: separating data
- From: "Travis " <sinusoid2@xxxxxxxxxxx>
- Date: Tue, 28 Jul 2009 13:47:01 +0000 (UTC)
TideMan <mulgor@xxxxxxxxx> wrote in message <d853c3bb-586e-4dd6-8fb1-b6d569572246@xxxxxxxxxxxxxxxxxxxxxxxxxxx>...
On Jul 28, 8:54?am, "Travis " <sinuso...@xxxxxxxxxxx> wrote:
ImageAnalyst <imageanal...@xxxxxxxxxxxxxx> wrote in message <7409b471-e14d-489f-bdff-043113213...@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>...
On Jul 27, 2:00?pm, "Travis " <sinuso...@xxxxxxxxxxx> wrote:
I have a dataset
(depth = -[0:5 5:-1:0 0:25 25:-1:0 0:26 26:-1:0];)
time = 1:118;
that I need to separate into sections of positive and negative slopes. ?I have been able to identify the regions using...
for i = 2:length(depth)-1;
if (depth(1,i-1)<=depth(1,i)) && (depth(1,i+1)>=depth(1,i))
g(i) = 1;
end
end
I know it is crude, but I couldn't come up with a better way. ?I need each of these regions to be part of 3d variables (u and d) so that I can tie them into a gui using the size of the variables.
------------------------------------------------------------------------
Are you aware of the diff() function?
OK, so that cleans up the for loop, but how would I then go about setting each + or - section as its own section in 3d variables?
Who knows what you mean by 3d variables? I have no idea.
But you can figure + and - by this:
dy=diff(depth)
iplus=find(dy > 0);
iminus=find(dy <= 0);
Now depth(iplus) are the depths where the slope is positive and depth
(iminus) are the depths where the slope is negative or zero.
Or alternatively (and preferably) by logical indexing:
iplus=dy > 0;
Now depth(iplus) are the depths where the slope is positive and depth
(~iplus) are the depths where slope is negative or zero.
What I mean by 3d variable is a variable x(:,:,:) where each section of + or - has its own x and y. so that the first period of negative slope would be sldown(1,:,:), second sldown(2,:,:), etc.
.
- References:
- separating data
- From: Travis
- Re: separating data
- From: ImageAnalyst
- Re: separating data
- From: TideMan
- separating data
- Prev by Date: Re: day of year to month
- Next by Date: Re: Regarding Matlab RF tool
- Previous by thread: Re: separating data
- Next by thread: Why are image pixels in matlab normalized to [0,1]?
- Index(es):
Relevant Pages
|