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

1 vue (au cours des 30 derniers jours)
Stephen toh
Stephen toh le 2 Nov 2012
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 commentaires
Azzi Abdelmalek
Azzi Abdelmalek le 2 Nov 2012
what do you mean?
Stephen toh
Stephen toh le 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'

Connectez-vous pour commenter.

Réponse acceptée

Mats
Mats le 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 commentaire
Stephen toh
Stephen toh le 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.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Statistics and Machine Learning Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by