How do I solve the error "Improper assignment with rectangular empty matrix" caused by an error in the find command?

1 回表示 (過去 30 日間)
I have the matrix B=[17.9250;17.9750;18.0250;18.0750;18.1250;18.1750] and I have the matrix A=(1800x1).
All values of matrix A are in B.
I want to find the position in A that the values of B are.
For this, I tried to use the find command in two ways:
i) out of the loop
C=find(A==18.1750);
ii) inside a loop, because I have several arrays like A
for k=1:length(A(:,1))
C(k)=find(B==A);
end
However error appears "Improper assignment with rectangular empty matrix", even if this value exists, someone has already passed this problem and can you help me?
I appreciate the attention.

採用された回答

Andrei Bobrov
Andrei Bobrov 2018 年 8 月 28 日
[~,C] = ismember(A,B);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by