I would like to retrieve ASCII/text data from a web service URL and import into Matlab as either a Table or Structure.
The basic format of the text is as below:
So there could be dozens of different sections of this text, each corresponding with its own separate "comment_headerZ_line" section. I don't exactly have a physical .txt file to work with since this info is obtained from a URL, so I've been trying to use the 'webread' function with the weboptions object to make this work (below).
webopts = weboptions('ContentReader',@readtable);
mydata = webread('theURL',webopts);
Unfortunately, the readtable function seems to break when it encounters the end of one data chunk, and the start of the next comment_header section:
Error using readContentFromFile (line 28)
The content reader issued the error message: "Reading failed at line 620. All lines of a text file must have the same
number of delimiters. Line 620 has 1 delimiters, while preceding lines have 2.
Do I need to try this with textscan instead? Or create a custom "@read_webtext" function for the handle of ContentReader? If possible, I would very much like to avoid having to download the physical file onto my workspace.