Re: separating data
- From: TideMan <mulgor@xxxxxxxxx>
- Date: Mon, 27 Jul 2009 16:29:50 -0700 (PDT)
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.
.
- Follow-Ups:
- Re: separating data
- From: Travis
- Re: separating data
- References:
- separating data
- From: Travis
- Re: separating data
- From: ImageAnalyst
- Re: separating data
- From: Travis
- separating data
- Prev by Date: Microsoft Jet Driver
- Next by Date: Problems building sparse matrices
- Previous by thread: Re: separating data
- Next by thread: Re: separating data
- Index(es):
Relevant Pages
|