How to transform a file composed on several vectors, transforming non-negative values of a certain column into "0" for those corresponding data?
- From: khaluaa7@xxxxxxxxx
- Date: 17 Jul 2006 14:19:56 -0700
Hello,
I am trying to transform a file (tmp.asc) made of three vectors based
on the data of the 2nd column
13 20 3
65 -16 9
43 -10 8
10 -5 2
5 10 0
0 0 0
I want to create a new file only containing negative values from column
2, the rest would become 0:
0 0 0
65 -16 9
43 -10 8
10 -5 2
0 0 0
0 0 0
Similarly for positive values from colum 2, the rest would become 0:
13 20 3
0 0 0
0 0 0
0 0 0
5 10 0
0 0 0
How would I do the following?
I know how to do the following:
%For values of column 2 <0
m=find(tmp(:,2)<0);
nf=[tmp(m,1) tmp(m,2) tmp(m,3)]
---output would be:
65 -16 9
43 -10 8
10 -5 2
%this would only save the data with Column 2 values <0
What should I do to also include other value of Column 2 greater and
equal to 0 to have this?
0 0 0
65 -16 9
43 -10 8
10 -5 2
0 0 0
0 0 0
Thank you.
.
- Follow-Ups:
- Prev by Date: handles
- Next by Date: Re: building a simulink model using an LMS adaptiv
- Previous by thread: handles
- Next by thread: Re: How to transform a file composed on several vectors, transforming non-negative values of a certain column into "0" for those corresponding data?
- Index(es):