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 CenterFile Exchange에서 Dynamic System Models에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by