Constant variable

5 ビュー (過去 30 日間)
justin
justin 2012 年 3 月 19 日
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

回答 (1 件)

Geoff
Geoff 2012 年 3 月 19 日
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-

カテゴリ

Help Center および File ExchangeDynamic System Models についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by