Borrar filtros
Borrar filtros

Character Restrictions in a Text File

3 visualizaciones (últimos 30 días)
jgillis16
jgillis16 el 18 de Oct. de 2015
Comentada: jgillis16 el 19 de Oct. de 2015
I am trying to restrict the 25th column of this text file by exporting entire line either of the following characters, "Ib, Ib/c, Ic, IIb, II, IIP, IIn, IIPec". How would I go about doing this?
I have attached my text file as a reference.

Respuestas (1)

Walter Roberson
Walter Roberson el 19 de Oct. de 2015
contents = fileread('observedsn.txt');
[starts, stops] = regexp(contents, '^([^|]*\|){24}(Ib|Ib/c|Ic|II|IIP|IIn|IIPec)\|.*$', 'start', 'end', 'lineanchors', 'dotexceptnewline');
Now the relevant lines are at contents(starts(K):stops(K)) for K = 1 : length(starts)
  1 comentario
jgillis16
jgillis16 el 19 de Oct. de 2015
How would I then export these restricted lines to a new text file?

Iniciar sesión para comentar.

Categorías

Más información sobre Text Data Preparation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by