How to extract data from multiple data files?

I have 250 files with various x, y and according times, t data for 55 individual points. I also have a boundary area that will be in accordance with the x and y data points. I am trying to figure out the time when points 16-20 of the 55 points meets the boundary area. How do I load all the data sets, extract those various values and compile them to have the 250 times that the paths interact with the boundary for the 5 of 55 points I am looking at?
Thanks!

5 件のコメント

Guillaume
Guillaume 2018 年 3 月 25 日
I recommend you
  • give an example file or at the very least describe the format (delimited text? what delimiter? with header? etc.)
  • explain what I have a boundary area actually mean.
  • explain what a point meets the boundary actually mean mathematically
jfrazie9
jfrazie9 2018 年 3 月 25 日
To give an example of the above comment;
The 250 files I am trying to read are a *.txt, space delimited, with 1 line of a header.
The boundary is a tab delimited *.txt file that defines the UTM boundary I am looking at.
I am looking for when the x coordinate, y coordinate or both intercept from the 250 files intercepts the boundary from the boundary file.
dpb
dpb 2018 年 3 月 25 日
This is a relatively straightforward task; what have you tried so far to solve you own problem?
Guillaume
Guillaume 2018 年 3 月 25 日
Well, relatively straightforward depending on what intercepts the boundary actually mean mathematically.
Given boundary points A and B, what does C intercepts mean? C == A or C == B (within some tolerance maybe?) or C on the segment between A and B (within some tolerance?) or something else.
As usual giving numeric examples is more useful than imprecise wording.
dpb
dpb 2018 年 3 月 25 日
Imprecise for certain, agreed, G...but since I would presume it simply means to find the sequential entries from one to the next for which a set of points is within/without the (again presumed) enclosed area...if the definition is more complex, so may be the calculation, granted.

サインインしてコメントする。

回答 (1 件)

dpb
dpb 2018 年 3 月 25 日

0 投票

In broad strokes,
bdr=readtable('boundaryfilename.txt','delimiter','tab');
d=dir('*.txt'); % use appropriate wildcard to get proper subset of files
for i=1:length(d)
tab=readtable(d(i).name,'delimiter','space');
...
insert boundary crossing logic here...
...
end
The above will return the data in tables and presumes the first record is a valid variable name for the header and a format for the time that can be inferred; you ignored the previous responder's request for necessary information to tell you more specifically as we have no way of knowing how the data are encoded.
Blank-delimited files are notoriously poor choice; if there's any missing data at all you'll have serious issues; strongly suggest generating those files using .csv or also tab-delimited instead although if can be assured the files are properly formed can get by.

カテゴリ

ヘルプ センター および File ExchangeData Import and Export についてさらに検索

質問済み:

2018 年 3 月 25 日

コメント済み:

dpb
2018 年 3 月 25 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by