Reading digits from a text file

Hi all,
I have a text file with 10000 rows and 20000 columns as follows.
10101100100010110.... 10000111101101010.... ... I need to add spaces in between each digit and put the output into 10000 by 20000 array. How can I do it using Matlab?
Thanks.

 Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 11 Jan 2015
Edited: Azzi Abdelmalek on 11 Jan 2015
str=['1010';'0010';'1111']
out=str-'0'

2 Comments

Hi, Thank you for your answer. But I need to read the digits from text file into Matlab before that. How could I do it? Thanks.
If you search this forum you will find hundreds (possibly thousands) of answers about how to read data from text files. Did you check any of them?
The Wiki is a good place to find information this kind of basic operation:

Sign in to comment.

More Answers (0)

Categories

Tags

Community Treasure Hunt

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

Start Hunting!