% Parameter:
FileName = 'C:\HP1.txt';Key = ' MODE ';NewFile = 'C:\HP1_ordered.txt';% Import text file and select lines starting with the Key string:
Str = fileread(FileName);CStr = strsplit(Str, '\n');Match = strncmp(CStr, Key, length(Key));CStr = CStr(Match);% Create new file and write matching lines:
fid = fopen(NewFile, 'w');if fid == -1 error('Cannot create new file: %s', NewFile);endfprintf(fid, '%s\n', CStr{:});fclose(fid);
Hello,
I used this script to extract rows with a specific start, and now I need to extract from this last file in attachment only a series of rows with a specific index (for example I want only a row every 10 rows).
Can you help me?
Thanks,
Alberto
Best Answer