extraction from notepad

Hi everyone, I have data in a notepad in the format of:
SLV|41|T|10|05:29:49:887|01/08/2011|f2=38.8504
GLD|41|R|10|05:29:51:674|01/08/2011|f98=158.6
GLD|41|T|10|05:29:51:674|01/08/2011|f2=158.3659
SLV|41|R|10|05:30:05:254|01/08/2011|f98=39.1628
SLV|41|T|10|05:30:05:254|01/08/2011|f2=38.8504
GLD|41|R|10|05:30:06:994|01/08/2011|f98=158.6
I want to extract 4 things from the notepad and bring it in to matlab:
GLD f2 values, GLD f98 values
SLV f2 values and SLV f98 values.
Look forward to a reply soon.
Thank you

1 commentaire

Oleg Komarov
Oleg Komarov le 15 Avr 2012
Are the vertical bars really there?
Since this question is related to your next one I'll tell you that you canimport SLV, GLD and just the numbers after f2 = ... dorectly. This will save you time.

Connectez-vous pour commenter.

Réponses (2)

bobby
bobby le 15 Avr 2012

0 votes

Well import in matlab in shape of an array and then remove all the other columns except the F-values. Or first open the notepad file in excel, so that it is converted in row/column format, and then import xls file in Matlab using xlsread('file.xls')

3 commentaires

Mate 2u
Mate 2u le 15 Avr 2012
My data is larger than 1 million in the notepad so cannot do it in excel. Is there a MATLAB code which can directly do this?
bobby
bobby le 15 Avr 2012
http://www.mathworks.com/help/techdoc/ref/importdata.html
I think this function can help you.
Mate 2u
Mate 2u le 15 Avr 2012
Thanks but very vague

Connectez-vous pour commenter.

Oleg Komarov
Oleg Komarov le 15 Avr 2012

0 votes

Soluion with textscan:
fid = fopen('C:\Users\Oleg\Desktop\test.txt');
out = textscan(fid,'%3s%*[^=]%f','Delimiter','=');
fid = fclose(fid);

Catégories

En savoir plus sur Environment and Settings dans Centre d'aide et File Exchange

Question posée :

le 15 Avr 2012

Community Treasure Hunt

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

Start Hunting!

Translated by