필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Nonconvential files data extract

조회 수: 1 (최근 30일)
John Gow
John Gow 2018년 9월 26일
마감: MATLAB Answer Bot 2021년 8월 20일
Having trouble converting my extract data from 'i' number of '.nom' files from cell to matrix. See below.
I have 70 sequential '.nom' files. I managed to get 'nomfiles' to 70x1 '2x1 cells' --> seventy 1x2 data points from seventy files.
I'm trying to extract nomfiles to get a matrix so I can actually use the data (mat2lab didn't work).
My last two lines before end does NOT give me a matrix of all my data, but rather gives me a single cell array that says '2x1 cell'.
How can I extract my data from 'i' number of files to get a final DataAll matrix?
Thank you.
Apkread = dir('*.nom');
ln = length(apkread);
nomfiles = cell(ln,1);
For i = 1:ln
fid = fopen(Apkread(i).name);
nomfiles {i} = textscan(fid,'%*s%*s%f%*s%*s%*s%[^\n\r],'Delimiter','\t','Headerlines',3);
fclose(fid);
Data = nomfiles{i};
DataAll(:,1) = Data
end
  댓글 수: 1
jonas
jonas 2018년 9월 26일
I think you're going to have to upload 1-2 files.

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2018년 9월 26일
Move these two lines from inside the for-loop to outside.
Data = nomfiles{i};
DataAll(:,1) = Data
In fact, you can change the two lines into one line and put it at the end
DataAll=cell2mat(nomfiles)
  댓글 수: 1
John Gow
John Gow 2018년 9월 26일
I got an error "cell2mat does not support cell arrays containing cell arrays or objects".
DataAll still seems to contain a [0;0;0] and a "2x1 cell" in the first column.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by