How to read out a textfile from a specific line
Show older comments
Hello Community,
I have a probably rather easy problem (at least for you guys). I have a textfile (attached) that is structured in lines and collums. And I want two specific collumns out of that file (Plasma_voltage_actual and Plasma_current_actual). Problem is that the first part of that text file has a different structure (just lines). So first I need to delete all the unnecessary stuff before the collumns start (actually no idea how to do that). That would be everything up to the line with which says "DATA RECORDINGS". What I want in the end is a Matrix with the headlines (Time Pressure Pres_set ...) and then the values for each collumn. Can you help me with that? The goal in the end is to take those two collumns and calculate the mean of them. But I guess I can (hopefully) figure that out on my own.
Thank you very much :)
Accepted Answer
More Answers (1)
Jeremy Hughes
on 23 Jan 2019
0 votes
You might try READTABLE with import options:
>> opts = detectImportOptions(filename)
% Check that the number of header lines looks right
>> opts.SelectedVariableNames = {... the names you want to read ...}
>> T = readtable(filename,opts)
Categories
Find more on Text Data Preparation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!