f



writing 0's and 1's

Hello, 

       I have a textedit file with values 0's and 1's. I want to change
the value of zero to +1 and the value of 1 to -1. and write back to the
file again. 

        Any help can be appreciated. 

 Thanks in advance. 

  Sridhar

0
Sridhar_Gadda
2/10/2005 1:02:20 PM
comp.lang.verilog 3837 articles. 2 followers. Post Follow

2 Replies
661 Views

Similar Articles

[PageSpeed] 41

Sridhar_Gadda wrote:
>        I have a textedit file with values 0's and 1's. I want to change
> the value of zero to +1 and the value of 1 to -1. and write back to the
> file again. 

sed 's/1/@/g;s/0/+1/g;s/@/-1/g' file > new_file
Hardly a Verilog question though.
0
Paul
2/10/2005 2:39:27 PM
If you have access to the program sed (within cygwin)

sed -e "s/1/-1/g" -e "s/0/+1/g" < input_file

- Newman

"Sridhar_Gadda" <sridhargadda@yahoo.com> wrote in message 
news:0d420176d6b2249a5705656ef88c351d@localhost.talkaboutprogramming.com...
> Hello,
>
>       I have a textedit file with values 0's and 1's. I want to change
> the value of zero to +1 and the value of 1 to -1. and write back to the
> file again.
>
>        Any help can be appreciated.
>
> Thanks in advance.
>
>  Sridhar
> 


0
newman5382
2/10/2005 2:56:45 PM
Reply:

Similar Artilces:

It's on-it's off-it's on, it's off -WHY?
IS THIS THE CORRECT FORUM? Hope so. We have three computer networked at home...all with Windows XP. one of those is a laptop. Some mornings all 3 can see each other and transfer files...then mysteriously one or more will disappear. No contact....then later it's back. The laptop is the worst. Most often it won't let us in...but sometimes it will. No obvious reason. The most INFURIATING part is the message "see your administrator". Dammit Bill Gates...don't you realize that most networks are small offices without a Majestic Royal Administrator sitting his i...

1 to 20 with x number of 1's, 2's, 3's, ... 20's
This is probably a simple thing to do, so perhaps someone would send me in the right direction. I need to generate a list containing numbers from 1 to 20, say. But I cant just use A = 1:20, for example, because that provides me only one instance of each of the values. What I need is X instances for each value. For example, 5 ones, twos, threes, and so forth. Is there a simple command for this? Regards, Ulrik. On Sep 9, 10:52=A0am, "Ulrik Nash" <u...@sam.sdu.dk> wrote: > This is probably a simple thing to do, so perhaps someone would send me i= n the right dir...

Prob getting '1's and '0's
Hi all =) I have a var named Data_Bin which is in <10614*8char> containing binary '1's and '0's. eg Data_Bin = 11111111 11111111 11111111 11111111 .... ... I tried 2 methods, Method 1: aa = []; for i=1:84912 aa = [aa, Data_Bin(i)]; end Result: It gave me a 1*1 matrix but if I transpose the result, it'll give me a col vector. Method 2: aa = []; for i=1:84912 aa (1, i) = Data_Bin(i); end Result: It gave me a row vector of [49 49 49 49 ...] How do I get a row vector, 1*84912, from Data_Bin?? Thank you. "yingmu h...

Error? s = assignin('base','s',tf('s'));
Hi, I need a little help here. Could anyone please tell me what is wrong with this command? s = assignin('base','s',tf('s')); The matlab syntax is -- assignin(ws, 'var', val) Basically I just want to add s=tf('s') into the base workspace. Jack "Jack" <Jack@Jill.com> wrote in message news:ef3e449.-1@webcrossing.raydaftYaTP... > Hi, > I need a little help here. Could anyone please tell me what is wrong > with this command? > > s = assignin('base','s',tf('s')); > > The matlab syntax is -- assignin(ws, 'var', val) > Basically I just want to add s=tf('s') into the base workspace. What does the error message say? Something about too many output arguments, right? How many output arguments does the documentation for ASSIGNIN show that it should return? How many are you asking it to return? http://www.mathworks.com/access/helpdesk/help/techdoc/ref/assignin.html -- Steve Lord slord@mathworks.com ...

seeing 1's and 0's
Dear all: Ok an learned about 1's and 0's and how to convert it decimal and back. But just wondering if it was possible to actually see the binaries in real life! In other words is it possible to actually open an executable and see all those 1's and 0's. From a geeky prespective, this would be kinda cool and a great way to learn this stuff! It would be kinda cool to change it lets say something that reads "google" to "googgle" by changing the binary itself. Any help would be greatly apprciated. Thanks in advance. al Alex Lee wrote: > Dear all: >...

It's primitive; it's dumb; it's brittle--but it's AI.
http://www.scn.org/~mentifex/aisource.html is a pathway to the http://code.google.com/p/mindforth AI project at Google Code. The AI is primitive because it has only enough features to demon- strate thinking. It is "dumb" inasmuch as it has barely any IQ. It is extremely brittle because the slightest change in the code can destroy the artificial mind crafted so painstakingly in Forth: Arthur -- http://agi-roadmap.org/Milestones -- ten years of progress. ...

Plotting from 1's and 0's
Hi, I am a FORTRAN and MATLAB user. I have created a cylindrical "pore" shaped within a rectangular lattice structure in FORTRAN using cartesian coordinates. This was made by giving each cell either a value of either 0 or 1, where 0 mean the cell represents a solid and 1 represents a liquid at a given cartesian coordinate. So the final output file I create at the end is in this format: (1 or 0) (x) (y) (Z) Where the first column represents a 1 or 0, depending on whether a solid or liquid is present. The second column is the x-coordinate, the third column is the...

how do I count 0's and 1's
After converting boolean true/false to (0,1) I'd like to count the number of ones during data acquisition or if better the number of trues before the conversion. Everything I tried accepted a different type of data (string or waveform instead of word) How about feed the boolean to a case loop selector and set a counter in the loop? Thank you Enrique, that works good. Just that I need to know the count with every consecutive, incoming value, not after the loop is finished. So a count in real time. Bernd Bernd R. wrote: > After converting boolean true/false to (0,1) I'd like to c...

0's & 1's matrix
Hello, I've got a huge matrix with only 0's and 1's on it separated by spaces. I need to delete every row which has less than 10 (or any given number) on 1's. Any ideas, please? -- Saludos, Angel Angel wrote: > Hello, > > I've got a huge matrix with only 0's and 1's on it separated by spaces. > I need to delete every row which has less than 10 (or any given number) > on 1's. Any ideas, please? > awk '{for(i=1;i<NF;i++} n+=$i;if(n>=LIMIT)print $0;n=0}' infile > outfile Angel wrote: > I've got ...

file stream 1's 0's ?
I need to program this. I'm not asking any code, but an idea from you would be helpful. Thanks. I open a binary file stream, which has millions or trillions of 1's & 0's some thing like this 1100100011101110111.......... for easy understanding lets take this 1 1 0 0 0 0 1 =X assume there is an idle case like this 1 1 1 1 1 1 1 = Y now Y has 7 cases, each case has 2 chances either 1 or 0 'Z' is particular case first position is changed to 0 1 1 1 1 1 1 0 and matched with X not as a number[whether x is y, or not], but from left to right checking 'individual&#...

counting 0's and 1's with an exception
I have a vector of 0's and 1's. I want to count the total number of 0's and 1's with one exception, a 0 followed by a 1 is only counted as 1, not 2. For example, the total number of 0's and 1's with the exception for, a = [ 0 0 1 1 0 1 0 ] would be 5, although the length of 'a' is 7. How might I go about doing this? Thanks, Nate On Jul 8, 1:40=A0pm, "Nate Jensen" <natejense...@gmail.com> wrote: > I have a vector of 0's and 1's. =A0I want to count the total number of 0'= s and 1's with one exception, a 0 followed by a 1 is ...

All 0's and all 1's subnets...availables ???
Hi. I would like more info on the following: I want to make some calculus of subnetting and I am looking for info about the numbers of subnets available. RFC 950 says I should use n bits for addressing till 2^n -2 subnets, and I should avoid all 0's and all 1's subnets. But on "VLSM" RFC 1878 it says it is not necessary to avoid these subnets. What should I do ? What is current RFC being applied ??? If I dont make VLSM (ie. all my subnets have the same number of hosts) , could I use all 0's and all 1's subnets ? Or are reserved ? Thanks Alberto Al...

An Army of Soulless 1's and 0's
By STEPHEN LABATON WASHINGTON, June 23 - For thousands of Internet users, the offer seemed all too alluring: revealing pictures of Jennifer Lopez, available at a mere click of the mouse. But the pictures never appeared. The offer was a ruse, and the click downloaded software code that turned the user's computer into a launching pad for Internet warfare. On the instructions of a remote master, the software could deploy an army of commandeered computers - known as zombies - that simultaneously bombarded a target Web site with so many requests for pages that it would be impossible for others to gain access to the site. And all for the sake of selling a few more sports jerseys. The facts of the case, as given by law enforcement officials, may seem trivial: a small-time Internet merchant enlisting a fellow teenager, in exchange for some sneakers and a watch, to disable the sites of two rivals in the athletic jersey trade. But the method was far from rare. Experts say hundreds of thousands of computers each week are being added to the ranks of zombies, infected with software that makes them susceptible to remote deployment for a variety of illicit purposes, from overwhelming a Web site with traffic -- a so-called denial-of- service attack -- to cracking complicated security codes. In most instances, the user of a zombie computer is never aware that it has been commandeered. The networks of zombie computers are used for a variety of purposes...

Random -1's and 1's
Hi Everyone, What is the most efficient way of creating a vector filled with -1's and 1's, with probability(-1) = probability(1)? Regards, Ulrik On 9/3/2011 5:54 AM, Ulrik Nash wrote: > Hi Everyone, > > What is the most efficient way of creating a vector filled with -1's and 1's, > with probability(-1) = probability(1)? > > Regards, > > Ulrik I am sure there is a better way, but why not use randperm(2) and just look at the first value returned, and if it is say 1, call this your '1', and if it is '2' call this your '-1...

display 1's and 0's of byte array
I am reading binary messages off of a port via UDP packets -> socket.receive(packet) I store the received packet into a byte array -> byte[] received = packet.getData(); I want to output in binary format the variable received. How do I get the 1's and 0's to display instead of the asii characters? Any help is greatly appreciated! <dan.ference@gmail.com> wrote: > I am reading binary messages off of a port via UDP packets -> > socket.receive(packet) > > I store the received packet into a byte array -> byte[] received = > packet.getData(); > >...

Binary output (literally 1's and 0's)
I'm working on a simple hex editing type program and I was wondering if there was any way to display the actual 1's and 0's of binary to the screen. For example if I had some character, 'a' for example, could I print the binary data for it, 01100001? This is a function I would really like to include, for educational purposes, so if there is anyway to do it, I would be be very happy if someone would tell me. Thanks. Nori ------------------------------------------------------------------------------------------------------------------------------------- I RTFM. "The...

convert array of 0's and 1's to integers
Hello, Is there a matlab function that can take an array of 0's and 1's and convert it to an array of numbers representing the 0's and 1's? (ie, convert the 0's and 1's to true binary) So, for example, each set of 32 1's and 0's would become a 32 bit integer, or whatever data type you choose. Thanks. bogfrog <jmcgraw@rcn.com> wrote in message <23675138.1217125756324.JavaMail.jakarta@nitrogen.mathforum. org>... > Hello, > > Is there a matlab function that can take an array of 0's and 1's and convert it to an array of numbers r...

100's of frames and 100's of alpha's into transparant GIF or PNG's
I render game sprites/floor tiles using lightwave. I output the frames and I output an alpha-image so I can seperate the objects from the renderings. I used to combine the alpha and the render in photoshop by hand, as photoshop can only load one batch of source files in it's action-macros. Now that the spritecount has risen into the double digits, I'm looking for a way to combine 100's of frames and 100's of alpha's into transparant GIF or PNG's. I have had no luck in photoshop for this, it only lets me specify one source folder per action. Does anyone have a clever ...

Help with code to shift and catch 0's and 1's
Hello, I need help with writing a piece of code. I have a data file that looks like this, say, one column with many rows as such (but to save space, I'll write it in a single row format): 00100010000 I need help with a code that can re-arrange to look like this: 00011110000 That is, reading from left-to-right, as soon as the first "1" appears, make that value "0" and change the next item from "0" to a "1" and continue until "1" appears again. Thanks! On 4/27/2011 3:28 AM, Jason wrote: > Hello, I need help with writing a piece of code....

how to create a row of 100 numbers of 1's and 0's?
Hi I am trying to create a neural network and I need a variable (called Targets) that will hold 100 numbers in one row, which will be the target numbers. These numbers need to be either 0 or 1 and need to be done in a random order in the row of the variable Targets. Something like this: 0 1 0 1 0 1 0 1 1 1 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 0 0 thanks In article <fn3bpq$h2t$1@fred.mathworks.com>, aristotelis aristou <aristo.telios@mathworks.com> wrote: >I am trying to create a neural network and I need a variable >(called Targets) that will hold 100 numbers in one row, >which...

finding consecutive 0's in a vector and replacing it by 1's
Dear matlab user, I have a 1x1000 vector, consisting of 1's and 0's. Now i would like to find four consecutive 0's in the vector and replace it by combination of 0's and 1's (for eg, 1101,1111,1010 any combination of the binary values from 1 to 15) but i should not touch or affect already existing 1's in the vector. Any help would be really appreciated, as i am new to matlab i find it very difficult. i found this http://www.mathworks.com/matlabcentral/fileexchange/24255-consecutive-vector-spliter but i couldn't understand the code. Thank you very much ...

conversion of binary image pixels to 0's and 1's
Now if any binary image is given how to convert that image to a matrix of 0's and 1's for pixels in white and black respectively? using matlab code or any c or c++ code On 5/25/2013 10:37 AM, faraz.a wrote: > Now if any binary image is given how to convert that image to a matrix >of 0's and 1's for pixels in white and black respectively? using matlab code or any c or c++ code > Image is a matrix and a binary image by definition is 0's and 1's. So there is nothing to convert or do. No code needed. ----------------------- load trees BW = im2bw(X,ma...

Python's __getattr__, Perl's autoload, Ruby's method_missing, and Smalltalk's #doesNotUnderstand
I'm still new here, and I just completed reading CLTL's documentation on packages and On Lisp's documentation on CLOS. It doesn't appear that Lisp has the equivalent of Python's __getattr__, Perl's autoload, Ruby's method_missing, and Smalltalk's #doesNotUnderstand. That is, there is no way I can do this (without new-function being defined): (new-function) and have it call some other function like this: (missing-symbol 'new-function) whose returning value will be evaluated as the value of new-function. Or did I miss something? Jonathan Gardner <...

The iPhone's features: What's new, what's not
http://crave.cnet.com/8301-1_105-9733965-1.html?tag=cnetfd.mt Unless you've cut yourself off from all media access this year, you know that on Friday, June 29 Apple will release its iPhone with AT&T. Ever since the device's unveiling last January, the tech world has been running in circles asking what the iPhone will be like, what it will do, and how it will do it. But because Apple hasn't been the leakiest of faucets when it comes to specs, the hype has resulted in a lot of speculation instead. Of course, that will all change in several days, as you can be sure everyone lucky...

Web resources about - writing 0's and 1's - comp.lang.verilog

Pulitzer Prize for Feature Writing - Wikipedia, the free encyclopedia
1979: Jon D. Franklin , Baltimore Evening Sun , for ' Mrs. Kelly's Monster ', "an account of brain surgery ." 1981: Teresa Carpenter , Village ...

Draymond Green Calls Out ESPN Writer for Writing There's 'Tension' with Warriors - Bleacher Report
Golden State Warriors forward Draymond Green has been a hot topic in the basketball world since his locker room outburst during halftime of Saturday ...

Writing Is Like Biking Up a Hill
For this writing analogy, let's pretend you're riding a bike and you hit a hill. If you jump off the bike halfway up the slope to take a break, ...

"Since I started writing about women and science, my female colleagues have been moved to share their ...
"... my inbox is an inadvertent clearinghouse for unsolicited love notes," writes geobiology prof A. Hope Jahren in the NYT . Sexual harassment ...

Is Paul Ryan Writing His Own Presidential Campaign Platform?
... it's just that I want the Democrats to recognize the direction from which their big challenge may be coming. Jennifer Steinhauer, writing for ...

George R.R. Martin Is Writing A Big Game Of Thrones Twist The Show Can't Do
When faced with the question of whether he should stick with his instincts in a scene for Winds of Winter or stick with what Game of Thrones ...

Friend of Harper Lee says he's writing book on her life
ATLANTA (AP) — A longtime friend of Harper Lee says he is writing a book on the Pulitzer-Prize winning author who wrote the American classic ...

Angie’s List Dropping Subscription Requirement For Review Writing & Browsing
... new model, dubbed “freemium,” will still come with a pricing structure that charges users for services beyond basic browsing and review writing. ...


The Writing Is On The Wall For Rubio
It is not Rubio’s time, no matter how much hack consultants try to argue otherwise

Resources last updated: 3/6/2016 10:48:23 PM