Reading text file leaving the comment section, extract multiple numerical data from it, and put them in respective variable
Show older comments
At the start of a text file there are few lines of comments with a style "#". After them I have floating point data corresponding to four variables- "serial", "gate_t", "gate_v", "gate_i". All of them (comment and data) are separated by space in the ".txt" file.
As shown in the figure, When I open the file using notepad a sequence of space separated data is seen. But if the file is opened in WordPad, after the "comments" the numerical (floating point) data are shown in columns.
Now i want to read the data only, and store them in respective variables (as seen in the WordPad) for further processing. That is in MATLAB, I want (please see the attached figure)
serial=[1 2 3 4 5 .......]
gate_t=[0.26466 0.42032 0.575914 0.731496 0.887091 .......]
etc.
How can I do it? Thanks in advance.
Alam

Answers (0)
Categories
Find more on Characters and Strings 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!