Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
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 Commenti
Stephen toh
Stephen toh il 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'

Accedi per commentare.

Risposta accettata

Mats
Mats il 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 Commento
Stephen toh
Stephen toh il 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.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Encryption / Cryptography in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by