I have a single column matrix with values ranging from around -15 to 50, there's around 19000 values and I wish to remove any values below 20 and set them as 0. This is what I currently have to import the data:
input = xlsread('HiG_67.csv','J:J');
Thanks

댓글 수: 1

Stephen23
Stephen23 2015년 10월 8일
Do not call your variable input as this is the name of a commonly used inbuilt function input. When you shadow the name of an inbuilt function like this it stops the inbuilt function from working.
For this reason never use the names size, length, input, i, j, cat, length, etc. You can use which to check if a name is already used-

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

 채택된 답변

Dennie
Dennie 2015년 10월 8일

0 개 추천

If input is a non-negative single column then you can use the following simple filter:
FilterValue=20;
input(input<FilterValue)=0;
If there are also negative values that you wish to keep then you can try:
input(abs(input)<FilterValue)=0;
If you only want to filter the positive noise:
filter=input<FilterValue & input>=0;
input(filter))=0;
Dennie

댓글 수: 4

OliK
OliK 2015년 10월 8일
If now I have say 30 'peaks' in my data how would I create a new matrix with only peaks 10-19 .
Image Analyst
Image Analyst 2015년 10월 8일
편집: Image Analyst 2015년 10월 8일
First find the peaks. findpeaks() in the Signal Processing Toolbox will help. Then, once you know the peaks go from, say, index 42 to index 173, just extract those indices:
peaks10To19 = allPeaks(index1 : index2);
where allPeaks is the name of your data array (like Thorsten said, it better not be "input"!!!).
OliK
OliK 2015년 10월 8일
Is there a way I can do it without Signal Processing Toolbox?
Image Analyst
Image Analyst 2015년 10월 8일
There are peak detectors in the File Exchange.

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

추가 답변 (1개)

Thorsten
Thorsten 2015년 10월 8일
편집: Thorsten 2015년 10월 8일

1 개 추천

x(x < 20) = 0;
BTW: Please don't call your variable input, it's a Matlab function.

카테고리

질문:

2015년 10월 8일

댓글:

2015년 10월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by