Sorting Data into managable sections for analysis

Hey,
If I have the following set of data for example:
10 10 10 5 5 5 0 0 0 -5 -5 -5 -10 -10 -10 -5 -5 -5 0 0 0 5 5 5 10 10 10
and so on (the cycle repeats), I want to be able to analyze the cycles individually. For example, the I want to first analyze the first 10:-10 cycle, then do the same with the next 10:-10 cycle, and so on and so forth. Can someone tell me how I can do this?
I was thinking using the find function in order to specify my window range, but find will not allow me to include the zeros. Any suggestions to help me look in the right place would be much appreciated! (:

댓글 수: 4

It is not clear to me how you want to define your window. It is not clear to me how specific this one case is, or how general it needs to be. I expect that if you put more thought into defining what you want to do, the rules for how to do it will become more evident.
Sarah
Sarah 2011년 10월 19일
For example, let us say that I have all this data in excel, and I upload that data into MATLAB. So lets say in excel there was a very large column of the following cycle being repeated again and again:
10 10 10 5 5 5 0 0 0 -5 -5 -5 -10 -10 -10
So I want to be able to cut that very long column of repeating cycle into each of the individual cycles, so that I can analyze each individual cycle rather than a whole set of data. You can consider one cycle to be my window. Does that make a little more sense?
Still trying to clarify. If your vector was x = [1 2 1 2 1 2 1 2], you would want to return y = [1 2]? And if x = [6 5 4 1 6 5 4 1 6 5 4 1], you would want to return y = [6 5 4 1]? In other words, you want to detect a repeating pattern, and return one instance of that pattern?
Sarah
Sarah 2011년 10월 19일
You are absolutely right, but I want multiple vectors. In taking your example,
let us say data was represented in excel as (the numbers on the far left represent rows in column A):
Column A
1 1
2 2
3 1
4 2
5 1
6 2
7 1
8 2
I want to be able to detect the pattern and then return ALL instances of the pattern. So vector X would be:
X = [1 2] which represents the data in rows 1 and 2 in excel.
Vector Y would be:
Y = [1 2] which represents the data in rows 3 and 4 in excel. Etc etc.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

질문:

2011년 10월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by