- 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
How to extract data from multiple data files?
2 次查看(过去 30 天)
显示 更早的评论
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
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
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
2018-3-25
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!