From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Nasser M. Abbasi" Newsgroups: comp.lang.ada Subject: is there Ada package similar to Matlab textscan? Date: Thu, 16 Jul 2015 22:52:33 -0500 Organization: Aioe.org NNTP Server Message-ID: Reply-To: nma@12000.org NNTP-Posting-Host: 8NUpq80EOZpQMEPcD5V8pw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 X-Notice: Filtered by postfilter v. 0.8.2 X-Mozilla-News-Host: news://nntp.aioe.org:119 Xref: news.eternal-september.org comp.lang.ada:26834 Date: 2015-07-16T22:52:33-05:00 List-Id: Matlab textscan() build-in function is very useful, I use it all the time to read textual data from text files. One bascially tells it the format of each field, and will load all the data to Matlab data structure (called cells). Then one can simply loop over the data and process it. The format used is that of printf() standard format. It is described here http://www.mathworks.com/help/matlab/ref/textscan.html One can also tell it how many lines to skip before starting to read (this is in order to bypass any file headers) and tell it what is the field delimiter between the columns of the data. For example, given this text file ----- foo.txt--------------------- Student_ID | Test1 | Test2 | Test3 1, 91.5, 89.2, 77.3 2, 88.0, 67.8, 91.0 3, 76.3, 78.1, 92.5 -------------------------------- It is read as C = textscan(fileID,'%d %f %f %f','HeaderLines',1,'Delimiter',',') That is all. Now C will contain all the data in, in what is called cell columns. C{1}, C{2}, C{3}, C{4}. Is there a similar way to read data using Ada or must one parse each field one by one themselves after reading the file line by line? I searched for an Ada package that does something similar to textscan, but so far did not find one. thanks, --Nasser