extracting specific data out of big data
4 次查看(过去 30 天)
显示 更早的评论
Dear all,
I have a set of data with first entry being the identifier and starts from 1 to 58769. Each entry has then 4 lines and 8 columns separated by space. I want to extraxt data for a vector like 1,5,9,......Can somebody guide me to achieve this as my skills are limited
Example of data
1 1 3 0 0 0 0 0
0.0 -33.7792 -2.59991 310.8271 42.04916 0.0 0.0 0.0
-0.7746 -33.7792 -2.59991 310.8271 42.04916 0.0 0.0 0.0
0.774597 -33.7792 -2.59991 310.8271 42.04916 0.0 0.0 0.0
2 1 3 0 0 0 0 0
0.0 -33.7792 -2.59991 310.8271 42.04916 0.0 0.0 0.0
-0.7746 -33.7792 -2.59991 310.8271 42.04916 0.0 0.0 0.0
0.774597 -33.7792 -2.59991 310.8271 42.04916 0.0 0.0 0.0
2 个评论
Bob Thompson
2019-11-15
What format are you storing the data in currently? My first thought would be to convert the entire thing to a string, and split it into different blocks by identifying the pattern of the first line.
blocks = regexp(fullstring,'.*(\d*\s+1\s+3\s+0\s+0\s+0\s+0\s+0\s*');
回答(2 个)
the cyclist
2019-11-15
Your question is not perfectly clear to me, especially regarding
- the size and shape of your input array(s)
- the exact output that you want from that input
But if M is an input matrix, then ...
M(1:4:end,:)
will be a matrix that has the 1st, 5th, 9th (and so on) rows, and all the columns.
0 个评论
fadzhi
2019-11-15
1 个评论
the cyclist
2019-11-15
Have you already pulled this text file into MATLAB? If so, can you upload a *.mat file with the data? There are several ways to do that, with potential differences in the resulting variables (e.g. they could be stored as a table, or as a cell array, or as numeric, etc).
And, again, what exactly do you want as the output? One numeric array with all the data? Each id stored separately?
You are leaving too much guesswork for us, which means a higher likelihood that we will provide a solution that does not meet your need.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!