Extract x and y coordinates for points in a multivariable function

I have a function of two variables(x and y). This function only has values of 0 and 1 for each point on the x-y grid. How would I extract the x,y location on the grid for the values which are 1? Thanks

 採用された回答

dpb
dpb 2016 年 10 月 4 日

0 投票

Given a z
[i,j]=find(z); % indices for lookup into x,y

2 件のコメント

Shaildhish Rai
Shaildhish Rai 2016 年 10 月 6 日
It works! Thanks
dpb
dpb 2016 年 10 月 6 日
Of course it works! :)
I'll point out that you can be assured it'll find the values since they're integers in this case. If z were some general f(x,y), one has to be careful the simple application of == (which is implied in the above find to locate exact values; even a single bit in the least significant portion of the mantissa will cause the comparison to fail.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeAerospace Blockset についてさらに検索

質問済み:

2016 年 10 月 4 日

コメント済み:

dpb
2016 年 10 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by