필터 지우기
필터 지우기

extracting specific data out of big data

조회 수: 5 (최근 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 CenterFile Exchange에서 Workspace 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