Can anybody help me with what this kind of thing means In MatLab
古いコメントを表示
I am studying some tagging with Blue crabs and I need to make sure I am on the right track with interpreting the data. Would anyone be able to tell me in simpler terms what the data below is trying to find?
idx_r1_A1 = find ( ant_num_r1 == 1 );
idx_r1_A2 = find ( ant_num_r1 == 2 );
idx_r2_A1 = find ( ant_num_r2 == 1 );
idx_r2_A2 = find ( ant_num_r2 == 2 );
idx_r3_A1 = find ( ant_num_r3 == 1 );
idx_r3_A2 = find ( ant_num_r3 == 2 );
idx_r4_A1 = find ( ant_num_r4 == 1 );
idx_r4_A2 = find ( ant_num_r4 == 2 );
1 件のコメント
Azzi Abdelmalek
2013 年 3 月 25 日
What is ant_num_r1 ?
回答 (2 件)
Walter Roberson
2013 年 3 月 25 日
0 投票
find() returns the index locations at which the condition was true. So the first find() is returning the indices in ant_num_r1 that were equal to 1.
Matt Kindig
2013 年 3 月 25 日
Each of the idx_rX... variables are the output of find, and are indicating the indices of where the expression inside the parentheses is true. To be clear:
- The expression
ant_num_r1 == 1
creates a logical matrix, the same size as ant_num_r1, where 1 (true) occurs everytime ant_num_r1 is equal to 1, and is 0 (false) otherwise.
- The find() function determines the index positions in ant_num_r1 where that expression is true (i.e. ant_num_r1 is equal to 1).
The ant_num_r1==2 is doing the same for when ant_num_r1 is equal to 2, and vice versa. Does this answer your question?
カテゴリ
ヘルプ センター および File Exchange で Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!