Nested For Loop with Different Iterations

1 回表示 (過去 30 日間)
Neha
Neha 2014 年 2 月 28 日
コメント済み: dpb 2014 年 2 月 28 日
Hi,
Let's say I have a few different arrays:
ClearedIds = [0 3]
IDs= [0 0 0 1 2 2 3 3 3]
Num= [12 13 14 20 31 32 13 14 15]
StartNum=[12 13]
EndNum = [14 15]
Arrays ClearedIds, StartNum, and EndNum will always be the same dimension (1xn).
Arrays IDs and Num will always be the same dimension (1xn).
The program should essentially be able to do this: Check the values of array ClearedIDs. Wherever the values of array ClearedIds match elements in Ids, check where values of arrays Num match the elements in StartNum and EndNum. Store those indices.
The final result should be: IndNum = [1 3; 7 9]
I was thinking that for loops might help with this but so far have not had luck with the logical statements.
Please let me know if further clarification is required.
Thank you for your help.
  2 件のコメント
Jan
Jan 2014 年 2 月 28 日
What have you tried so far an which problems are you struggeling with?
dpb
dpb 2014 年 2 月 28 日
Yeah, I don't see how the result given actually comes from the description as written...

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by