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

1 次查看(过去 30 天)
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 个评论
Stephen toh
Stephen toh 2012-11-3
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'

请先登录,再进行评论。

采纳的回答

Mats
Mats 2012-11-2
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 个评论
Stephen toh
Stephen toh 2012-11-3
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Encryption / Cryptography 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by