extracting specific data out of big data

16 ビュー (過去 30 日間)
fadzhi
fadzhi 2019 年 11 月 15 日
コメント済み: the cyclist 2019 年 11 月 15 日
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 件のコメント
Guillaume
Guillaume 2019 年 11 月 15 日
Can you attach an example file?
Bob Thompson
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
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.

fadzhi
fadzhi 2019 年 11 月 15 日
I have attached an example of the data which i manually copy pasted (id.851, 853,855,863 and so on). I just want to automate the process, where i provide a list of number to extract from the main data file
Regards,
  1 件のコメント
the cyclist
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.

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

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT-Files についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by