Constant variable

10 Ansichten (letzte 30 Tage)
justin
justin am 19 Mär. 2012
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

Antworten (1)

Geoff
Geoff am 19 Mär. 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-

Kategorien

Mehr zu Dynamic System Models finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by