필터 지우기
필터 지우기

how can i choose a certain row from simulation?

조회 수: 1 (최근 30일)
arkedia
arkedia 2013년 1월 16일
i make a simulation it's results is a matrix so, if the run =500, i'll have 500 matrix my quistion is..........i want to choose certain row from those martrces the row is .....[xxx 1 0 0 0]...note xxx means the existing number it's different from matrix to another
  댓글 수: 3
arkedia
arkedia 2013년 1월 16일
편집: Jan 2013년 1월 16일
matrix one [18 1 0 0 0;15 1 0 1 0;20 0 0 0 1]
matrix two [30 1 0 0 0;20 1 0 1 0;50 0 1 0 0]
matrix three [10 1 0 1 0;20 1 0 0 0;40 0 0 1 0]
...the new matrix i want consists of [18 1 0 0 0;30 1 0 0 0;20 1 0 0 0]
Jan
Jan 2013년 1월 16일
I do not see the relation between the three input arrays and the output. Please explain the procedure with all required details. Do not use explanations as "matrix one", but the valid Matlab syntax like "A= [...]". It is unclear in which format you store the 500 matrices, but this detail matters.

댓글을 달려면 로그인하십시오.

채택된 답변

José-Luis
José-Luis 2013년 1월 16일
your_mat = [18 1 0 0 0;...
15 1 0 1 0;...
20 0 0 0 1];
idxFun = @(x) find(ismember(x(:,2:end),[1 0 0 0],'rows'));
your_row = your_mat(idxFun(your_mat),:);
Then you can concatenate:
your_result = [your_row1;your_row2;your_row3];

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 App Building에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by