How to verify a while loop and run it correctly?
2 ビュー (過去 30 日間)
古いコメントを表示
Hello, I have written a code using a while loop. which basically uses 3 input matrices, two of which are identical in dimensions, suppose (10*3): MI1, and MI2. the third one is (10*100): MI3. The objective is to get a final matrix: M that is (n*3), the nbr of rows depends on the conditions that while loop has to check: My simulation is based on these steps: 1st row of the output matrix M is = to the the 1st row of MI1. then it compares MI1(2,3) to MI2(1,3), if MI1(2,3)>max(MI2(:,3:end) then M(2,:)=MI1(2,:), else M(2,:)=MI2(row(where the max is),:); then the max(MI2) selected already is replaced by a value from MI3, indexed at MI2((where the max is, 2))+1; and this will continue until the loop runs throw all the rows of MI1. I can provide my code and a very small data set if necessary. I hope my explanation is clear.
Thanks
0 件のコメント
回答 (1 件)
Muhammad Usman Saleem
2016 年 2 月 25 日
edit your question again and post code with error you are getting?
Only after my understanding i recommend you to use For loop rather than While loop which may run for infinity iritations
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!