필터 지우기
필터 지우기

WHAT IS THE WRONG HERE?

조회 수: 2 (최근 30일)
Amr Hashem
Amr Hashem 2015년 5월 14일
댓글: Amr Hashem 2015년 5월 15일
I AM TRYING TO FIND ALL CELLS IN A WICH EQUAL B THE CODE :
for j=1:length(defs) % loop over Mdr of defib
querymdr=data2(:,1); % "A" save MDR numbers
y=alldata(:,1); % "B"
idx= find(y==querymdr); % FIND ALL CELLS WHICH IS EQUAL
it gives me an error in
idx= find(y==querymdr);
what was i write wrong?
  댓글 수: 3
Amr Hashem
Amr Hashem 2015년 5월 14일
querymdr has 5*1 cells, y has 37*1 cells
i want to find all the cells in y that matched(has the same numeric value) with querymed.
thats the whole file... i choose 5 cells in the first column (left).
and want to know all the cell in the first coulmn (right) which = it
Amr Hashem
Amr Hashem 2015년 5월 15일
i have this two tables querymdr & idx2 :
i want to compare the fisrt two coulmns of them , and the multiple value copy column 6 of it only
i want to have the answer like this:
what i can do? any one has an idea?

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2015년 5월 14일
querymdr = cellfun(@(C) C{1}, data2); %presuming the first entry is a scalar!
ally = cellfun(@(C) C{1}, alldata); %presuming the first entry is a scalar!
Now you have two numeric vectors to compare. What you would do from there would depend on whether you are expecting multiple matches for each entry.
  댓글 수: 5
Walter Roberson
Walter Roberson 2015년 5월 15일
What error message does it give you?
Please show
class(data2)
class(alldata);
Amr Hashem
Amr Hashem 2015년 5월 15일
the class of both is cell

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by