Clear Filters
Clear Filters

How do i extract this text data columns by columns ? thanks

1 view (last 30 days)
DEADBEEFDEADBEEF encrypt
deadbeefdeadbeef encrypt
DEADBEEFDEADBEEF sign
deadbeefdeadbeef sign
0123456789ABCDEF encrypt
0123456789ABCDEF sign
,1.3/a@4$pR6^-?" sign
,1.3/a@4$pR6^-?" encrypt
What code should i use to receive the data in columns?
  2 Comments
Stephen toh
Stephen toh on 3 Nov 2012
much thanks. i want to use the data above in columns as a input argument to my function. for eg, the first column contain the 16 ascii characters while the second column just read either 'encrpt' or 'sign'

Sign in to comment.

Accepted Answer

Mats
Mats on 2 Nov 2012
I guess you mean something like this:
fileID = fopen('data.txt');
C = textscan(fileID, '%s %s','delimiter', ' ');
fclose(fileID);
column1 = C{1}, column2 = C{2}
  1 Comment
Stephen toh
Stephen toh on 3 Nov 2012
Thanks for the help, just another qn. If i were to read the data in each columm separately, is there any way i can verify whether each row in the 1st column is a 16 ASCII character and the second column is either 'encrypt' or 'sign'?
i.e : After extracting the data form the file,
i want to verify rowwise 'DEADBEEFDEADBEEF' is a ASCII character then correspondingly verify ' encrypt' and not 'sign'
this process will loop until theres no more data, meaning we have no idea how much data we are given in the text file. Yup greatly appreciated if u give me some advice.

Sign in to comment.

More Answers (0)

Categories

Find more on Encryption / Cryptography in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!