file scanning

12 Ansichten (letzte 30 Tage)
student
student am 23 Mär. 2012
I want to create a function that will scan the characters in a txt file one-by-one and when it encounters a certain character, it will skip the next 6 characters.
What would be the easiest/efficientist to do this?
thanks,
  1 Kommentar
Oleg Komarov
Oleg Komarov am 23 Mär. 2012
Scan and do what next? Or you mean import import all except those 6 after the specific one?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Jan
Jan am 23 Mär. 2012
Str = fileread('FileName.txt');
match = strfind(Str, '$');
index = zeros(1, length(Str));
index(match) = 1;
index(match + 5) = -1;
index = cumsum(index);
Str(index(1:length(Str)) = [];

Kategorien

Mehr zu Files and Folders finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by