Data processing

Hello, How to sample data for every 40 ms. As my data is quite big (75000ms)I'd like to display only every 40th sample of my data in a form of simple table (1st row :ms), second row:values)
Thanks for your help.

 채택된 답변

Image Analyst
Image Analyst 2011년 11월 13일

1 개 추천

Just do what you did and then say
y = y(1:40:end);
By the way, that (75,000 elements) is a long, long way from being a "quite big" matrix.

댓글 수: 6

Fangjun Jiang
Fangjun Jiang 2011년 11월 13일
That will work but it's quite a waste. There should be a better way.
Image Analyst
Image Analyst 2011년 11월 13일
What's a waste? He already has the matrix, using Jan's solution, and the matrix is quite small - only 75,000 elements and ends up being even smaller, just 1/40th of that size, so it's quite tiny. At numbers this small I wouldn't spend much time trying to speed things up unless he needs to do this in near real time, like during a 1/30th of a second frame time of a live video. I'd probably visualize with a plot rather than a table, but a table is fine if you need to see individual elements.
Image Analyst
Image Analyst 2011년 11월 13일
You can use the uitable control, if you really think your users are going to be perusing individual elements of a 750,000 element table. That's not a big array but it is big for people to be examining individual values by eye. You might also have a plot or image of the data to give people an idea of what element they want to home in on to see what they need to see. 750,000 / 40 (18,750) elements if quite big to randomly browse around in if you don't have any guidance as to where to look. For example if they see something weird on the plot at locations 4232 and 16795 that will help them find those locations in the table at those rows.
Walter Roberson
Walter Roberson 2011년 11월 14일
Perhaps use spy() ?
Image Analyst
Image Analyst 2011년 11월 14일
I feel you're leaving off the end of the story here. What do you really plan on doing with the data? Look for spikes/peaks? Look for valleys? Look for some kind of pattern? You're not just going to visually examine thousands of points and that's the end of it. What's the next step?
Walter Roberson
Walter Roberson 2011년 11월 14일
Sounds like a sparse() matrix might be appropriate. But it depends on how you want to examine your data. Sometimes with data like this, you are best off just using a tool such as SPSS.

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

추가 답변 (1개)

Fangjun Jiang
Fangjun Jiang 2011년 11월 13일

1 개 추천

Here is a different way to do it.
t=[00 08 255 267 298 300];
y=[5 4 3 4 3 2];
figure(1);hold on;
stairs(t,y);
tnew=0:40:400;
index=bsxfun(@le,t',tnew);
ynew=y(sum(index));
stem(tnew,ynew);

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2011년 11월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by