필터 지우기
필터 지우기

Info

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

Import connected cell values into an array

조회 수: 1 (최근 30일)
Brendan Görres
Brendan Görres 2020년 10월 1일
마감: MATLAB Answer Bot 2021년 8월 20일
Hey guys,
I am trying to import certain data from a 1756x2 cell array "aParts" into a vector. The cell array contains element numbers in one column and the related label in the second column. The purpose is to store every element with the same label in one vector.
What I have already done is to create an array where the indices for example for the label "Cavity" are stored.
Now i would like to export every element (from "aParts" column 1) where "aCavla" is 1 into a new vector. How can I do that?
Here is the code I got so far
for idx = 1:ilEle %Create Matrix with Elements and related label
aParts{idx,1}= (aElements(idx));
aParts{idx,2}= (aName(idx));
aCavla{idx}=strfind(aParts{idx,2},'Cavity');
end
ilEle is a the length of th cell array "aParts", so in this particular example it equals 1756.
Thanks in advance
  댓글 수: 1
Stephen23
Stephen23 2020년 10월 1일
You don't need a loop, either use accumarray or splitapply:

답변 (0개)

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by