matlab help to read a textfile

Status
Not open for further replies.

knight_rider007

Newbie level 1
Joined
Aug 21, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
6
hi all,
I am new in matlab,
I wish to read a textfile with 32bit unsigned values,I wish to read first bit of every value and need to write it on on another text file
somebody pls give me suggestions
 

filename = 'xxxx.txt'
data = load(filename)
data_bin = dec2bin(data)
...
after that you can access by array indexing..

data_bin(i,end) is the first bit of the i-th value (located at index i)..

or you can use mod(data(i), 2).. which gives whether the value is even or odd.. even means first bit is zero.. odd means first bit is one.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…