Constant variable
5 views (last 30 days)
Show older comments
As for my second question, is there a command I can state where the matrix info(10000x3) can be display the info(:,1) when info(:,2)<100 & ~=0 and when info(:,3) increases by 20 at the same time? Thanks for any help
0 Comments
Answers (1)
Geoff
on 19 Mar 2012
You can combine this all into a long command line, but let's split it up for clarity:
col2select = info(:,2) < 100 & info(:,2) ~= 0;
col3select = [0; diff(info(:,3))] == 20;
result = info(col2select & col3select, 1);
I assumed that you wanted only an exact increase in 20 from the previous line in column 3. It's easy to modify this to your needs.
This will output only the relevant rows. You can of course find the indices of those rows if you need:
indices = find(col2select & col3select);
-g-
0 Comments
See Also
Categories
Find more on Dynamic System Models in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!