matlab - Ignoring certain number of rows while reading text file -


I want to read a text file in matlab, but when I read that I have to leave a certain number of headers, The number should not be fixed then I want to start over again from the last non-deleted line in a certain number. So for example, I would like to ignore the first 7 rows and start from the 8th row to the next 100 rows.

How can I do this easily?

Thank you!

Assume that you have a text file with the number of header numbers in the N_header There is a data.txt in which 5 integers per line and you want to read N_lines from this file.

Create a link for the first file so that you need MatLab: ('Data.txt')% Create a File ID

Now you can set the N_lines lines You can read and use textscan except N_header headerlines:

  N_header = 7; N_lines = 100; FormatSpec = '% d% d% d% d% d'; Whitspace C = five integers per line, separated by textscan (FID, formatSpec, N_lines, 'HeaderLines', N_header); Fclose (FID)   

Columns in your text file are stored in C {column number}. If you want to keep each line stored in C:

  formatSpec = '% s'; % Complete string, that is, each line C = textscan (FID, formatSpec, N_lines, 'delimiter', '\ n', 'header lines', n-header); The line array '\ n'   

saves every row in the cell array.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -