Extract identical values from a data set
古いコメントを表示
Hi everyone,
I have a data set for polar coordinates from this command:
[TH,R,Z] = cart2pol(xdata,ydata,zdata);
I then want to find same values of R and corresponding to them values of Z. I have tried these commands:
u=unique(R);
n=histc(R,u);
u(n>1);
find(R==u(n>1))
which gives me an error: Error using == Matrix dimensions must agree.
Error in NSMatlabNPC (line 108) find(R==u(n>1))
And tried to use
find(diff(R)==0)
which returned me an empty matrix 1 by 0.
The problem is probably that I have several identical R of different values and these functions might not be suitable to identify them separately. Are there any other ways I could use to access the same R values?
採用された回答
その他の回答 (1 件)
the cyclist
2014 年 7 月 2 日
0 投票
I think you probably want to use the ismember() command.
3 件のコメント
Sofya
2014 年 7 月 2 日
Sofya
2014 年 7 月 2 日
the cyclist
2014 年 7 月 2 日
I have to admit am not digging into the details here (sorry!), but note that the ismember command has a second output argument, which is an index that might help you.
doc ismember
for details.
カテゴリ
ヘルプ センター および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!