Logical indexing of cell array

조회 수: 3 (최근 30일)
jnaumann
jnaumann 2015년 11월 3일
편집: Thorsten 2015년 11월 4일
Hi all,
There is a probably a very simple solution to this but my mind has gone blank. I have a matrix which I am filtering on using logical indexing of another matrix e.g.
new_matrix=old_matrix(diff_matrix>50)
This works fine however I am trying to do the same thing, this time with a cell array e.g
new_cell_Array=old_cell_Array(diff_matrix>50)
but in this instance nothing happens - the old array and new array are the same size. Any ideas of how I use indexing to filter to the same entries in my cell array as my matrix?
I hope this makes sense
  댓글 수: 3
jnaumann
jnaumann 2015년 11월 4일
Thanks for your response - I have added the data I mentioned in my first post
Adam
Adam 2015년 11월 4일
When I run your code on those arrays I get a result array that is 5 elements shorter than the old_cell_array so it seems to work fine. The syntax is certainly fine since diff_matrix is a logical array.

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

답변 (1개)

Thorsten
Thorsten 2015년 11월 4일
편집: Thorsten 2015년 11월 4일
I tried it with your variables and it worked fine.
>> size(old_cell_array)
ans =
196.00 1.00
>> new_cell_array=old_cell_array(diff_matrix>50);
>> size(new_cell_array)
ans =
191.00 1.00
Maybe you confused old_cell_array and old_cell_Array, or something like that?

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by